public void InitializeShouldInitializeConnection() { this.mockCommunicationManager.Setup(x => x.HostServer()).Returns(1); requestHandler.InitializeCommunication(); this.mockCommunicationManager.Verify(x => x.HostServer(), Times.Once); this.mockCommunicationManager.Verify(x => x.AcceptClientAsync(), Times.Once); }
public void InitializeShouldThrowExceptionIfExceptionIsThrownByCommunicationManager() { this.mockCommunicationManager.Setup(x => x.HostServer()).Throws <Exception>(); var requestHandler = new DataCollectionTestCaseEventHandler(this.mockCommunicationManager.Object); Assert.ThrowsException <Exception>(() => { requestHandler.InitializeCommunication(); }); }