예제 #1
0
        public async Task CanUseParamForLiteral()
        {
            var responseCreator = new LiteralResponse("$foo", endpoint);

            Assert.Equal("FOO", await responseCreator.GetBodyAsync(null));

            fooParam.Value = "BAR";
            Assert.Equal("BAR", await responseCreator.GetBodyAsync(null));
            Assert.Equal("BAR", (await GetResponseAsync(responseCreator)).WrittenContent);
        }
예제 #2
0
        public void ReplacementsAreExecuted()
        {
            var responseCreator = new LiteralResponse("abc def");

            responseCreator.Replacements = new[]
            {
                new BodyReplacement {
                    SearchTerm = "abc", ReplacementTerm = "ABC"
                },
                new BodyReplacement {
                    SearchTerm = "def", ReplacementTerm = "DEF"
                }
            };

            var body = responseCreator.GetBodyAndExecuteReplacements(null);

            Assert.Equal("ABC DEF", body);
        }
예제 #3
0
        public async Task ReplacementsAreExecuted()
        {
            var responseCreator = new LiteralResponse("abc def", new Endpoint("foo", "bar"))
            {
                Replacements = new[]
                {
                    new BodyReplacement {
                        SearchTerm = "abc", ReplacementTerm = "ABC"
                    },
                    new BodyReplacement {
                        SearchTerm = "def", ReplacementTerm = "DEF"
                    }
                }
            };
            var body = await responseCreator.GetBodyAndExecuteReplacementsAsync(null);

            Assert.Equal("ABC DEF", body);
        }