public async void Should_handle_null_request()
        {
            //ASSEMBLE - empty template but empty json
            var fakeHtmlTemplate = TestFactory.TestHtmlTemplate();
            var fakeJson         = new { };
            var request          = TestFactory.CreateValidHtmlContentRequest(fakeJson);

            //ACT - send our assembled test data into the method we are testing
            var response = await ReplaceHtmlContent.Run(null, logger, fakeHtmlTemplate);

            //ASSERT
            string responseBodyString = await response.Content.ReadAsStringAsync();

            Assert.Equal("Poorly formatted request", responseBodyString);
        }
        public async void Should_ignore_bad_json()
        {
            //ASSEMBLE - empty template but bad json
            var fakeHtmlTemplate = TestFactory.TestHtmlTemplate();
            var badJson          = "  {   {'bad':json }}}} format   }";
            var request          = TestFactory.CreateCorruptHtmlContentRequest(badJson);

            //ACT - send our assembled test data into the method we are testing
            var response = await ReplaceHtmlContent.Run(request, logger, fakeHtmlTemplate);

            //ASSERT - check that the response catches this specific scenario and doesnt cause any exceptions along
            // the way
            string responseBodyString = await response.Content.ReadAsStringAsync();

            Assert.Equal("Invalid JSON provided", responseBodyString);
        }
        public async void Should_handle_null_logger()
        {
            //ASSEMBLE - empty template but empty json
            var fakeHtmlTemplate = TestFactory.TestHtmlTemplate();
            var fakeJson         = new { };
            var request          = TestFactory.CreateValidHtmlContentRequest(fakeJson);

            try
            {
                //ACT - send our assembled test data into the method we are testing
                var response = await ReplaceHtmlContent.Run(request, null, fakeHtmlTemplate);
            }
            catch (ArgumentException)
            {
                Assert.True(true);
            }
        }
        public async void Should_ignore_empty_html()
        {
            //ASSEMBLE - empty template but valid json
            var fakeHtmlTemplate = "";
            var fakeJson         = new
            {
                value1 = "TestInput1",
                value2 = "TestInput2",
                value3 = DateTime.Now.ToString(),
                value4 = "TestInput4"
            };
            var request = TestFactory.CreateValidHtmlContentRequest(fakeJson);

            //ACT - send our assembled test data into the method we are testing
            var response = await ReplaceHtmlContent.Run(request, logger, fakeHtmlTemplate);

            //ASSERT - check that the response catches this specific scenario and doesnt cause any exceptions along
            // the way
            string responseBodyString = await response.Content.ReadAsStringAsync();

            Assert.Equal("No HTML provided", responseBodyString);
        }
        public async void Should_return_not_modified_html_if_unchanged()
        {
            //ASSEMBLE - instantiate a valid html template and try to update a value that
            // does not exist in it. you should still receive the same html with a not-modified status
            // to help indicate a value provided cant be inserted
            var fakeHtmlTemplate = TestFactory.TestHtmlTemplate();
            var fakeJson         = new
            {
                valueThatdoesntExistInTemplate = "TestInput1",
            };
            var request = TestFactory.CreateValidHtmlContentRequest(fakeJson);


            //ACT - send our assembled test data into the method we are testing
            var response = await ReplaceHtmlContent.Run(request, logger, fakeHtmlTemplate);


            //ASSERT -
            string responseBodyString = await response.Content.ReadAsStringAsync();

            Assert.Equal(HttpStatusCode.NotModified, response.StatusCode);
        }