Exemplo n.º 1
0
        public void Should_Return_Not_Equal_When_At_Least_One_Of_Corresponding_Inner_Collections_Items_Is_Not_Equal_Using_Default_Equality()
        {
            // fixture setup
            var item1 = new ObjectWithSingleStringProperty();
            var item2 = new ObjectWithSingleStringProperty();
            var item3 = new ObjectWithSingleStringProperty();

            var value = new AnotherTypeWithInnerCollectionBuilder()
                        .WithInnerCollectionItem(item1)
                        .WithInnerCollectionItem(item2)
                        .Build()
            ;

            var other = new TypeWithInnerCollectionBuilder()
                        .WithInnerCollectionItem(item1)
                        .WithInnerCollectionItem(item3)
                        .Build()
            ;

            // exercise
            var result = value.AsSource().OfLikeness <TypeWithInnerCollection>()
                         .WithCollectionSequenceEquals(t => t.Collection, s => s.OtherCollection)
                         .Equals(other);

            // verify
            Assert.That(result, Is.False);
        }
Exemplo n.º 2
0
        public void Should_Return_Not_Equal_When_Source_Inner_Collection_Is_Null_And_Destination_Inner_Collection_Is_Not_Null()
        {
            // fixture setup
            var value = new AnotherTypeWithInnerCollectionBuilder()
                        .WithNullInnerCollection()
                        .Build()
            ;

            var other = new TypeWithInnerCollectionBuilder()
                        .WithInnerCollectionItemsCount(2)
                        .Build()
            ;

            // exercise
            var result = value.AsSource().OfLikeness <TypeWithInnerCollection>()
                         .WithCollectionSequenceEquals(t => t.Collection, s => s.OtherCollection)
                         .Equals(other);

            // verify
            Assert.That(result, Is.False);
        }
Exemplo n.º 3
0
        public void Should_Return_Not_Equal_When_Inner_Collections_Counts_Are_Different(int valueCollectionCount, int otherCollectionCount)
        {
            // fixture setup
            var value = new AnotherTypeWithInnerCollectionBuilder()
                        .WithInnerCollectionItemsCount(valueCollectionCount)
                        .Build()
            ;

            var other = new TypeWithInnerCollectionBuilder()
                        .WithInnerCollectionItemsCount(otherCollectionCount)
                        .Build()
            ;

            // exercise
            var result = value.AsSource().OfLikeness <TypeWithInnerCollection>()
                         .WithCollectionSequenceEquals(t => t.Collection, s => s.OtherCollection)
                         .Equals(other);

            // verify
            Assert.That(result, Is.False);
        }