Example #1
0
        public void SendDataCollectionMessageShouldSendMessageToCommunicationManager()
        {
            var requestHandler = new DataCollectionRequestHandler(this.mockCommunicationManager.Object, this.mockMessageSink.Object, this.mockDataCollectionManager.Object, this.mockDataCollectionTestCaseEventHandler.Object);
            var message        = new DataCollectionMessageEventArgs(TestMessageLevel.Error, "message");

            requestHandler.SendDataCollectionMessage(message);

            this.mockCommunicationManager.Verify(x => x.SendMessage(MessageType.DataCollectionMessage, message), Times.Once);
        }
Example #2
0
        public void SendDataCollectionMessageShouldThrowExceptionIfThrownByCommunicationManager()
        {
            this.mockCommunicationManager.Setup(x => x.SendMessage(MessageType.DataCollectionMessage, It.IsAny <DataCollectionMessageEventArgs>())).Throws <Exception>();
            var requestHandler = new DataCollectionRequestHandler(this.mockCommunicationManager.Object, this.mockMessageSink.Object, this.mockDataCollectionManager.Object, this.mockDataCollectionTestCaseEventHandler.Object);
            var message        = new DataCollectionMessageEventArgs(TestMessageLevel.Error, "message");

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