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); }
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); }
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"); }