public void RealtimeConnectionsService_ShouldPassThough() { var fakeIWebSocketConnectionsService = new FakeIWebSocketConnectionsService(); var fakeINotificationQuery = new FakeINotificationQuery(); var service = new RealtimeConnectionsService(fakeIWebSocketConnectionsService, fakeINotificationQuery, new FakeIWebLogger()); service.NotificationToAllAsync( new ApiNotificationResponseModel <string>(), CancellationToken.None); Assert.AreEqual(1, fakeIWebSocketConnectionsService.FakeSendToAllAsync.Count); Assert.AreEqual(1, fakeINotificationQuery.FakeContent.Count); }
public void CleanOldMessagesAsync_Exception_Handle_Test() { var fakeIWebSocketConnectionsService = new FakeIWebSocketConnectionsService(); var fakeINotificationQuery = new FakeINotificationQuery(new Exception("t")); var service = new RealtimeConnectionsService(fakeIWebSocketConnectionsService, fakeINotificationQuery, new FakeIWebLogger()); service.NotificationToAllAsync( new ApiNotificationResponseModel <string>(), CancellationToken.None); service.CleanOldMessagesAsync(); // service has thrown an exception so the remove is ignored Assert.AreEqual(1, fakeINotificationQuery.FakeContent.Count); }