예제 #1
0
        public void CloseShouldNotThrowExceptionIfCommunicationManagerIsNull()
        {
            var requestHandler = new DataCollectionTestCaseEventHandler(null, new Mock <IDataCollectionManager>().Object, this.dataSerializer.Object);

            requestHandler.Close();

            this.mockCommunicationManager.Verify(x => x.StopServer(), Times.Never);
        }
        public void CloseShouldStopServer()
        {
            var requestHandler = new DataCollectionTestCaseEventHandler(this.mockCommunicationManager.Object);

            requestHandler.Close();

            this.mockCommunicationManager.Verify(x => x.StopServer(), Times.Once);
        }
        public void DisposeShouldNotThrowExceptionIfCommunicationManagerIsNull()
        {
            var requestHandler = new DataCollectionTestCaseEventHandler(null);

            requestHandler.Close();

            this.mockCommunicationManager.Verify(x => x.StopServer(), Times.Never);
        }
        public void CloseShouldThrowExceptionIfThrownByCommunicationManager()
        {
            this.mockCommunicationManager.Setup(x => x.StopServer()).Throws <Exception>();
            var requestHandler = new DataCollectionTestCaseEventHandler(this.mockCommunicationManager.Object);

            Assert.ThrowsException <Exception>(
                () =>
            {
                requestHandler.Close();
            });
        }
        public void CloseShouldStopServer()
        {
            requestHandler.Close();

            this.mockCommunicationManager.Verify(x => x.StopServer(), Times.Once);
        }