コード例 #1
0
        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);
        }
コード例 #2
0
        public void InitializeShouldThrowExceptionIfExceptionIsThrownByCommunicationManager()
        {
            this.mockCommunicationManager.Setup(x => x.HostServer()).Throws <Exception>();
            var requestHandler = new DataCollectionTestCaseEventHandler(this.mockCommunicationManager.Object);

            Assert.ThrowsException <Exception>(() =>
            {
                requestHandler.InitializeCommunication();
            });
        }