public void Get_IndexOutOfBounds(int[] input, string position) { // Arrange var targetObject = new List <int>(input); var listAdapter = new ListAdapter(); var options = new JsonSerializerOptions(); // Act var getStatus = listAdapter.TryGet(targetObject, typeof(List <int>), position, options, out _, out var message); // Assert Assert.False(getStatus); Assert.Equal($"The index value provided by path segment '{position}' is out of bounds of the array size.", message); }
public void Get_IndexOutOfBounds(int[] input, string position) { // Arrange var resolver = new DefaultContractResolver(); var targetObject = new List <int>(input); var listAdapter = new ListAdapter(); // Act var getStatus = listAdapter.TryGet(targetObject, position, resolver, out var value, out var message); // Assert Assert.False(getStatus); Assert.Equal($"The index value provided by path segment '{position}' is out of bounds of the array size.", message); }
public void Get(int[] input, string position, object expected) { // Arrange var targetObject = new List <int>(input); var listAdapter = new ListAdapter(); var options = new JsonSerializerOptions(); // Act var getStatus = listAdapter.TryGet(targetObject, typeof(List <int>), position, options, out var value, out _); // Assert Assert.True(getStatus); Assert.Equal(expected, value); Assert.Equal(new List <int>(input), targetObject); }
public void Get(int[] input, string position, object expected) { // Arrange var resolver = new DefaultContractResolver(); var targetObject = new List <int>(input); var listAdapter = new ListAdapter(); // Act var getStatus = listAdapter.TryGet(targetObject, position, resolver, out var value, out var message); // Assert Assert.True(getStatus); Assert.Equal(expected, value); Assert.Equal(new List <int>(input), targetObject); }