public void IListIndexOfShouldReturnCorrectValue()
 {
     IList<string> target = new VariantObservableCollection<string, object>();
     var expected = "test";
     Assert.Equal( -1, target.IndexOf( expected ) );
     target.Add( expected );
     Assert.Equal( 0, target.IndexOf( expected ) );
 }
        public void IListShouldPerformRemoveAt()
        {
            // arrange
            IList<string> target = new VariantObservableCollection<string, object>();
            target.Add( "test" );
            Assert.Equal( 1, target.Count );

            // act
            target.RemoveAt( 0 );

            // assert
            Assert.Equal( 0, target.Count );
        }
        public void IListIndexerShouldBeReadWrite()
        {
            // arrange
            IList<string> target = new VariantObservableCollection<string, object>();
            var expected = "test";
            
            target.Add( string.Empty );
            Assert.Equal( 1, target.Count );

            // act
            target[0] = expected;

            // assert
            Assert.Equal( expected, target[0] );
        }
        public void CollectionShouldBehaveAsExpectedWhenSuppliedToReadOnlyAdapter()
        {
            // arrange
            var expectedProperties = new[] { "Count", "Item[]" };
            var actualProperties = new List<string>();
            var target = new VariantObservableCollection<string, object>();
            var expected = new ReadOnlyObservableCollection<object>( target );

            ( (INotifyPropertyChanged) target ).PropertyChanged += ( s, e ) => actualProperties.Add( e.PropertyName );

            // act
            target.Add( "test" );

            // assert
            Assert.Equal( expectedProperties.Length, actualProperties.Count );
            Assert.True( actualProperties.SequenceEqual( expectedProperties ) );
            Assert.Equal( expected.Count, target.Count );
            Assert.Equal( expected[0], target[0] );
            Assert.IsType<string>( target[0] );
            Assert.IsType<string>( expected[0] );
        }
        public void IListShouldReturnEnumerator()
        {
            IList<string> target = new VariantObservableCollection<string, object>();
            var expected = new[] { "test1", "test2", "test3" };

            foreach ( var item in expected )
                target.Add( item );

            IEnumerable<string> actual = target;

            Assert.True( actual.SequenceEqual( expected ) );
        }
        public void IListShouldPerformRemove( string item, bool expected )
        {
            // arrange
            IList<string> target = new VariantObservableCollection<string, object>();
            
            target.Add( "test" );

            // act
            var actual = target.Remove( item );

            // assert
            Assert.Equal( expected, actual );
        }
        public void IListShouldPerformCopyTo()
        {
            // arrange
            IList<string> target = new VariantObservableCollection<string, object>();
            var expected = new string[3];

            target.Add( "test1" );
            target.Add( "test2" );
            target.Add( "test3" );

            // act
            target.CopyTo( expected, 0 );

            // assert
            Assert.True( target.SequenceEqual( expected ) );
        }
        public void IListShouldPerformContains()
        {
            // arrange
            IList<string> target = new VariantObservableCollection<string, object>();
            var expected = "test";

            // act
            target.Add( expected );

            // assert
            Assert.True( target.Contains( expected ) );
        }