コード例 #1
0
        public void Remove_CheckRemoveOfElementsFromEmptyArray_ReturnFalse(int value)
        {
            //arrange
            var arr = new DynamicSortedArray <int>();

            //act & assert
            Assert.False(arr.Remove(value));
        }
コード例 #2
0
        public void Remove_CheckRemoveOfElementsThatAreNotInArray_ReturnFalse(int value)
        {
            //arrange
            var arr = new DynamicSortedArray <int> {
                3, 1, 5, 8, 1, 6
            };

            //act & assert
            Assert.False(arr.Remove(value));
        }
コード例 #3
0
        public void Remove_CheckRemoveOfElementsThatAreInCollection_ReturnTrue(int value)
        {
            //arrange
            var arr = new DynamicSortedArray <int> {
                3, 1, 5, 8, 1, 6
            };

            //act & assert
            Assert.True(arr.Remove(value));
        }
コード例 #4
0
        public void Remove_CheckThatEventRaisedWhenDeletingElementFromArray_ReturnNothing()
        {
            //arrange
            var arr = new DynamicSortedArray <int> {
                2, 2, 5, 8, 1, 6
            };
            var itemToRemove = 1;
            //act
            var receivedEvent = Assert.Raises <RemoveFromArrayEventArgs <int> >(
                a => arr.Removed += a,
                a => arr.Removed -= a,
                () => { arr.Remove(itemToRemove); });

            //assert
            Assert.NotNull(receivedEvent);

            Assert.Equal(itemToRemove, receivedEvent.Arguments.RemovedItem);
            Assert.Equal($"{itemToRemove} was removed", receivedEvent.Arguments.Message);
        }