public void SetUp() { _webSocketMock = new Mock <IWebSocket>(MockBehavior.Strict); _webSocketMock.Setup(m => m.WebSocketState).Returns(JsonRpcWebSocketState.Open); _webSocketMock.Setup(m => m.Id).Returns(Guid.NewGuid().ToString("N")); _webSocketService = new TestWebSocketService(); _webSocketConnection = _webSocketService; }
public void RemoveSession_Exists_Removed() { // ARRANGE var service = new TestWebSocketService(_connectionManager); ((WebSocketConnection)service).WebSocket = _websocketMock.Object; _connectionManager.AddSession(service); // ACT _connectionManager.RemoveSession(service); // ASSERT Assert.That(_connectionManager.GetAll <TestWebSocketService>(), Has.Count.EqualTo(0)); }
public void GetAll_Exists_Returned() { // ARRANGE var service = new TestWebSocketService(_connectionManager); ((WebSocketConnection)service).WebSocket = _websocketMock.Object; _connectionManager.AddSession(service); // ACT var result = _connectionManager.GetAll <TestWebSocketService>(); // ASSERT Assert.That(result, Has.Count.EqualTo(1)); }
public void GetById_Exists_Returned() { // ARRANGE var service = new TestWebSocketService(_connectionManager); ((WebSocketConnection)service).WebSocket = _websocketMock.Object; _connectionManager.AddSession(service); // ACT var result = _connectionManager.GetById <TestWebSocketService>(service.Id); // ASSERT Assert.That(result, Is.Not.Null); }