Exemple #1
0
        public async void Http_trigger_should_return_known_string_from_member_data(string queryStringKey, string queryStringValue)
        {
            var request  = TestFactory.CreateHttpRequest(queryStringKey, queryStringValue);
            var response = (OkObjectResult)await HttpFunction.Run(request, logger);

            Assert.Equal($"Hello, {queryStringValue}", response.Value);
        }
Exemple #2
0
        public async void Http_trigger_should_return_known_string()
        {
            var request  = TestFactory.CreateHttpRequest("name", "Bill");
            var response = (OkObjectResult)await HttpFunction.Run(request, logger);

            Assert.Equal("Hello, Bill", response.Value);
        }
        public async Task NameNotFoundDefaultMessage()
        {
            var            request = HttpTestFactory.CreateHttpRequest("", "");
            OkObjectResult rs      = (OkObjectResult)await HttpFunction.Run(request, logger);

            Assert.AreEqual((int)HttpStatusCode.OK, rs.StatusCode);
            Assert.AreEqual("This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.", rs.Value);
        }
        public async Task HttpFunctionShouldReturnSetString()
        {
            //var logger = Substitute.For<ILogger>();
            var            request = HttpTestFactory.CreateHttpRequest("name", "Jorge");
            OkObjectResult result  = (OkObjectResult)await HttpFunction.Run(request, logger);

            Assert.AreEqual((int)HttpStatusCode.OK, result.StatusCode);
            Assert.AreEqual("Hello, Jorge. This HTTP triggered function executed successfully.", result.Value);
        }
        public async Task ReturnStringFromBody()
        {
            var httpreq = Substitute.For <HttpRequest>();

            httpreq.Body = HttpTestFactory.GenerateBody("{\"name\":\"Igor\"}");
            OkObjectResult rs = (OkObjectResult)await HttpFunction.Run(httpreq, logger);

            Assert.AreEqual((int)HttpStatusCode.OK, rs.StatusCode);
            Assert.AreEqual("Hello, Igor. This HTTP triggered function executed successfully.", rs.Value);
        }