Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
josephnhtam committed Oct 28, 2024
1 parent 4491b0a commit 8601e79
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,6 +20,7 @@ public class RtmpMessageDispatcherTest
private readonly ITestContext _context;
private readonly DataBuffer _payloadBuffer;
private readonly IRtmpMessageDispatcher<ITestContext> _sut;
private readonly ILogger<RtmpMessageDispatcher<ITestContext>> _logger;
private IRtmpChunkStreamContext _chunkStreamContext;

public RtmpMessageDispatcherTest()
Expand All @@ -36,6 +38,8 @@ public RtmpMessageDispatcherTest()
_chunkStreamContext = Substitute.For<IRtmpChunkStreamContext>();
_chunkStreamContext.PayloadBuffer.Returns(_payloadBuffer);

_logger = Substitute.For<ILogger<RtmpMessageDispatcher<ITestContext>>>();

var map = new RtmpMessageHandlerMap(new Dictionary<byte, Type> {
{ 1, typeof(TestHandler) },
{ 2, typeof(Test2Handler) },
Expand All @@ -45,7 +49,7 @@ public RtmpMessageDispatcherTest()
services.AddSingleton(_testHandler)
.AddSingleton(_test2Handler)
.AddSingleton<IRtmpMessageDispatcher<ITestContext>>(svc =>
new RtmpMessageDispatcher<ITestContext>(svc, map));
new RtmpMessageDispatcher<ITestContext>(svc, map, _logger));

_sut = services.BuildServiceProvider().GetRequiredService<IRtmpMessageDispatcher<ITestContext>>();
}
Expand Down

0 comments on commit 8601e79

Please sign in to comment.