Exemple #1
0
        public void Remove(int[] input, string position, int[] expected)
        {
            // Arrange
            var targetObject = new List <int>(input);
            var listAdapter  = new ListAdapter();
            var options      = new JsonSerializerOptions();

            // Act
            var removeStatus = listAdapter.TryRemove(targetObject, typeof(List <int>), position, options, out _);

            // Assert
            Assert.True(removeStatus);
            Assert.Equal(new List <int>(expected), targetObject);
        }
Exemple #2
0
    public void Remove(int[] input, string position, int[] expected)
    {
        // Arrange
        var resolver     = new DefaultContractResolver();
        var targetObject = new List <int>(input);
        var listAdapter  = new ListAdapter();

        // Act
        var removeStatus = listAdapter.TryRemove(targetObject, position, resolver, out var message);

        // Assert
        Assert.True(removeStatus);
        Assert.Equal(new List <int>(expected), targetObject);
    }
Exemple #3
0
        public void Remove_IndexOutOfBounds(int[] input, string position)
        {
            // Arrange
            var targetObject = new List <int>(input);
            var listAdapter  = new ListAdapter();
            var options      = new JsonSerializerOptions();

            // Act
            var removeStatus = listAdapter.TryRemove(targetObject, typeof(List <int>), position, options, out var message);

            // Assert
            Assert.False(removeStatus);
            Assert.Equal($"The index value provided by path segment '{position}' is out of bounds of the array size.", message);
        }
Exemple #4
0
    public void Remove_IndexOutOfBounds(int[] input, string position)
    {
        // Arrange
        var resolver     = new DefaultContractResolver();
        var targetObject = new List <int>(input);
        var listAdapter  = new ListAdapter();

        // Act
        var removeStatus = listAdapter.TryRemove(targetObject, position, resolver, out var message);

        // Assert
        Assert.False(removeStatus);
        Assert.Equal($"The index value provided by path segment '{position}' is out of bounds of the array size.", message);
    }