CK.Core.Tests.UtilInterlockedTests.InterlockedRemove_an_item_from_an_array C# (CSharp) Method

InterlockedRemove_an_item_from_an_array() private method

private InterlockedRemove_an_item_from_an_array ( ) : void
return void
        public void InterlockedRemove_an_item_from_an_array()
        {
            int[] a = new[] { 1, 2, 3, 4, 5, 6, 7 };
            Util.InterlockedRemove( ref a, 1 );
            CollectionAssert.AreEqual( a, new[] { 2, 3, 4, 5, 6, 7 } );
            Util.InterlockedRemove( ref a, 4 );
            CollectionAssert.AreEqual( a, new[] { 2, 3, 5, 6, 7 } );
            Util.InterlockedRemove( ref a, 3712 );
            CollectionAssert.AreEqual( a, new[] { 2, 3, 5, 6, 7 } );
            Util.InterlockedRemove( ref a, 7 );
            CollectionAssert.AreEqual( a, new[] { 2, 3, 5, 6 } );
            Util.InterlockedRemove( ref a, 3 );
            CollectionAssert.AreEqual( a, new[] { 2, 5, 6 } );
            Util.InterlockedRemove( ref a, 5 );
            CollectionAssert.AreEqual( a, new[] { 2, 6 } );
            Util.InterlockedRemove( ref a, 3712 );
            CollectionAssert.AreEqual( a, new[] { 2, 6 } );
            Util.InterlockedRemove( ref a, 6 );
            CollectionAssert.AreEqual( a, new[] { 2 } );
            Util.InterlockedRemove( ref a, 2 );
            CollectionAssert.AreEqual( a, Util.Array.Empty<int>() );

            var aEmpty = a;
            Util.InterlockedRemove( ref a, 2 );
            Assert.That( a, Is.SameAs( aEmpty ) );

            Util.InterlockedRemove( ref a, 3712 );
            Assert.That( a, Is.SameAs( aEmpty ) );

            a = null;
            Util.InterlockedRemove( ref a, 3712 );
            Assert.That( a, Is.Null );

        }