Пример #1
0
        public void GetPositiveMessage_should_log_message()
        {
            // Arrange
            var             logger          = (ListLogger)TestFactory.CreateLogger(LoggerTypes.List);
            MessageFunction messageFunction = new MessageFunction(_messageResponderServer.Object);

            // Act
            messageFunction.GetPositiveMessage(null, logger);

            // Assert
            var msg = logger.Logs[0];

            msg.Should().Contain("MessageFunction - C# HTTP trigger function processed a request for GetPositiveMessage.");
        }
Пример #2
0
        public void GetPositiveMessage_Http_trigger_should_return_known_string()
        {
            // Arrange
            MessageFunction messageFunction = new MessageFunction(_messageResponderServer.Object);
            var             request         = TestFactory.CreateHttpRequest();

            // Act
            var response = (OkObjectResult)messageFunction.GetPositiveMessage(request, logger).Result;

            // Assert
            response.Value.Should().Be("Everything's great!");
            _messageResponderServer.Verify(x => x.GetPositiveMessage(), Times.Once);
            _messageResponderServer.Verify(x => x.GetNegativeMessage(), Times.Never);
            _messageResponderServer.Verify(x => x.GetSecretMessage(), Times.Never);
        }