Esempio n. 1
0
        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);
        }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
    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);
    }