public void GetNormalized_MultipleProperties_ReturnsSelf() { var element = new JsonPathPropertyListElement(new[] { "a", "b" }); var actual = element.GetNormalized(); actual.Should().Be(element); }
public void Matches_UnknownPropertyNamesList_ReturnsFalse() { var element = new JsonPathPropertyListElement(new[] { "name0", "name1", "name2" }); var other = new JsonPathPropertyListElement(new[] { "name0", "name1", "name2", "name3" }); bool?actual = element.Matches(other); actual.Should().BeFalse(); }
public void Matches_KnownPropertyName_ReturnsTrue() { var element = new JsonPathPropertyListElement(new[] { "name0", "name1", "name2" }); var other = new JsonPathPropertyElement("name0"); bool?actual = element.Matches(other); actual.Should().BeTrue(); }
public void GetNormalized_SingleProperty_ReturnsPropertyElement() { var element = new JsonPathPropertyListElement(new [] { "name" }); var expected = new JsonPathPropertyElement("name"); var actual = element.GetNormalized(); actual.Should().BeEquivalentTo(expected); }
public void Matches_Any_ReturnsFalse(JsonPathElementType type) { var element = new JsonPathPropertyListElement(new[] { "name0", "name1" }); var other = ElementCreator.CreateAny(type); bool?actual = element.Matches(other); actual.Should().BeFalse(); }
private static void AppendPropertyList(this StringBuilder builder, JsonPathPropertyListElement element) { builder.Append('['); bool isFirst = true; foreach (string name in element.Names) { if (isFirst) { isFirst = false; } else { builder.Append(','); } builder.Append('\''); builder.Append(name); builder.Append('\''); } builder.Append(']'); }
public void IsNormalized(bool expected, params string[] names) { var element = new JsonPathPropertyListElement(names); element.IsNormalized.Should().Be(expected); }