From 8601e793c459af58bccf905655b65aaaaf44e475 Mon Sep 17 00:00:00 2001 From: Joseph Tam Date: Mon, 28 Oct 2024 13:22:29 +0800 Subject: [PATCH] fix: unit test --- .../Dispatcher/RtmpMessageDispatcher.Test.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/LiveStreamingServerNet.Rtmp.Test/RtmpEventHandlers/Dispatcher/RtmpMessageDispatcher.Test.cs b/test/LiveStreamingServerNet.Rtmp.Test/RtmpEventHandlers/Dispatcher/RtmpMessageDispatcher.Test.cs index 4a73c02f..1c4e985e 100644 --- a/test/LiveStreamingServerNet.Rtmp.Test/RtmpEventHandlers/Dispatcher/RtmpMessageDispatcher.Test.cs +++ b/test/LiveStreamingServerNet.Rtmp.Test/RtmpEventHandlers/Dispatcher/RtmpMessageDispatcher.Test.cs @@ -7,6 +7,7 @@ using LiveStreamingServerNet.Utilities.Buffers; using LiveStreamingServerNet.Utilities.Buffers.Contracts; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using NSubstitute; namespace LiveStreamingServerNet.Rtmp.Test.RtmpEventHandlers.Dispatcher @@ -19,6 +20,7 @@ public class RtmpMessageDispatcherTest private readonly ITestContext _context; private readonly DataBuffer _payloadBuffer; private readonly IRtmpMessageDispatcher _sut; + private readonly ILogger> _logger; private IRtmpChunkStreamContext _chunkStreamContext; public RtmpMessageDispatcherTest() @@ -36,6 +38,8 @@ public RtmpMessageDispatcherTest() _chunkStreamContext = Substitute.For(); _chunkStreamContext.PayloadBuffer.Returns(_payloadBuffer); + _logger = Substitute.For>>(); + var map = new RtmpMessageHandlerMap(new Dictionary { { 1, typeof(TestHandler) }, { 2, typeof(Test2Handler) }, @@ -45,7 +49,7 @@ public RtmpMessageDispatcherTest() services.AddSingleton(_testHandler) .AddSingleton(_test2Handler) .AddSingleton>(svc => - new RtmpMessageDispatcher(svc, map)); + new RtmpMessageDispatcher(svc, map, _logger)); _sut = services.BuildServiceProvider().GetRequiredService>(); }