Ejemplo n.º 1
0
        public void Should_check_when_should_execute(string propertyName, string propertyValue, bool shouldExecute)
        {
            var property = new KeyValuePair <string, JToken>(propertyName, propertyValue);

            var processor = new RequestReplaceProcessor();

            processor.ShouldExecute(property).Should().Be(shouldExecute);
        }
Ejemplo n.º 2
0
        public void Should_read_request_value(string json, string propertyName, string replaceProperty,
                                              string expectedValue)
        {
            var request       = JsonConvert.DeserializeObject <JObject>(json);
            var urlParameters = new Dictionary <string, string>();

            var result    = new JObject();
            var processor = new RequestReplaceProcessor();

            processor.Execute(result, new KeyValuePair <string, JToken>(propertyName, replaceProperty), request,
                              urlParameters);

            result[propertyName].Value <string>().Should().Be(expectedValue);
        }
Ejemplo n.º 3
0
        public void Should_throw_when_property_not_found(string json, string propertyName, string replaceProperty)
        {
            var request       = JsonConvert.DeserializeObject <JObject>(json);
            var urlParameters = new Dictionary <string, string>();

            var result    = new JObject();
            var processor = new RequestReplaceProcessor();

            processor
            .Invoking(x =>
                      x.Execute(result, new KeyValuePair <string, JToken>(propertyName, replaceProperty), request,
                                urlParameters))
            .Should()
            .Throw <InvalidOperationException>()
            .WithMessage("Sequence contains no matching element");
        }