public void Visit_InvalidIndexFormatToArray_Fails(string position) { // Arrange var visitor = new ObjectVisitor(new ParsedPath($"/Customers/{position}/States/-"), new DefaultContractResolver()); var automobileDepartment = new Class1Nested(); object targetObject = automobileDepartment; // Act var visitStatus = visitor.TryVisit(ref targetObject, out var adapter, out var message); // Assert Assert.False(visitStatus); Assert.Equal($"The path segment '{position}' is invalid for an array index.", message); }
public void Visit_InvalidIndexFormatToArray_Fails(string position) { // Arrange var visitor = new ObjectVisitor(new ParsedPath($"/Customers/{position}/States/-"), new JsonSerializerOptions()); var automobileDepartment = new Class1Nested(); object targetObject = automobileDepartment; var targetType = targetObject.GetType(); // Act var visitStatus = visitor.TryVisit(ref targetObject, ref targetType, out _, out var message); // Assert Assert.False(visitStatus); Assert.Equal($"The path segment '{position}' is invalid for an array index.", message); }
public void Visit_InvalidIndexToArray_Fails(string position) { // Arrange var visitor = new ObjectVisitor(new ParsedPath($"/Customers/{position}/States/-"), new JsonSerializerOptions()); var automobileDepartment = new Class1Nested(); object targetObject = automobileDepartment; var targetType = typeof(Class1Nested); // Act var visitStatus = visitor.TryVisit(ref targetObject, ref targetType, out _, out var message); // Assert Assert.False(visitStatus); Assert.Equal($"The index value provided by path segment '{position}' is out of bounds of the array size.", message); }
public void Visit_InvalidIndexToArray_Fails(string position) { // Arrange var visitor = new ObjectVisitor(new ParsedPath($"/Customers/{position}/States/-"), new DefaultContractResolver()); var automobileDepartment = new Class1Nested(); object targetObject = automobileDepartment; // Act var visitStatus = visitor.TryVisit(ref targetObject, out var adapter, out var message); // Assert Assert.False(visitStatus); Assert.Equal( string.Format("The index value provided by path segment '{0}' is out of bounds of the array size.", position), message); }