public void AddConnection() { service.AddConnection(); Assert.AreEqual(Connections.Count, 1); Assert.AreEqual(Connections["Varunastra"].Count, 1); var service2 = new ConnectionService( Mocks.GetMockIHttpContextAccessor(user2), connectionManagerService); service2.AddConnection(); Assert.AreEqual(Connections.Count, 2); Assert.AreEqual(Connections["Valera"].Count, 1); Assert.AreEqual(Connections["Varunastra"].Count, 1); var service3 = new ConnectionService( Mocks.GetMockIHttpContextAccessor(user1), connectionManagerService); service3.AddConnection(); Assert.AreEqual(Connections.Count, 2); Assert.AreEqual(Connections["Varunastra"].Count, 2); Assert.AreEqual(Connections["Valera"].Count, 1); }
public void RemoveConnection() { var serviceManager = new ConnectionManagerService(); var service2 = new ConnectionService( Mocks.GetMockIHttpContextAccessor(user1), serviceManager); var service3 = new ConnectionService( Mocks.GetMockIHttpContextAccessor(user1), serviceManager); service2.AddConnection(); service2.RemoveConnection(); Assert.AreEqual(serviceManager.Connections.Count, 0); service2.AddConnection(); service3.AddConnection(); service3.RemoveConnection(); Assert.AreEqual(serviceManager.Connections.Count, 1); Assert.AreEqual(serviceManager.Connections["Varunastra"].Count, 1); }