public void WhenApplierIsNotSupportedThenThrows()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();
            var applier = new Mock <IPatternApplier <int, string> >();

            ActionAssert.Throws <ArgumentOutOfRangeException>(() => source.Merge(applier.Object));
        }
Esempio n. 2
0
        public void WhenApplierIsNotSupportedThenThrows()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();
            var applier = new Mock <IPatternApplier <int, string> >();

            Executing.This(() => source.Merge(applier.Object)).Should().Throw <ArgumentOutOfRangeException>();
        }
        private IPatternsAppliersHolder GetPatternsAppliersHolderWithApplierAdded <TSubject, TApplyTo>()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();
            var applier = new Mock <IPatternApplier <TSubject, TApplyTo> >();

            source.Merge(applier.Object);
            return(source);
        }
        public void WhenAddDelegatedAdvancedApplierThenAlwaysAdd()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();

            source.Collection.Add(new DelegatedAdvancedApplier <MemberInfo, ICollectionPropertiesMapper>(x => true, (x, y) => { }));
            source.Merge(new DelegatedAdvancedApplier <MemberInfo, ICollectionPropertiesMapper>(x => true, (x, y) => { }));

            source.Collection.Count.Should().Be(2);
        }
        public void WhenExistsApplierOfSameTypeThenDoesNotAdd()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();
            var toAdd = new BidirectionalManyToManyInverseApplier();

            source.Collection.Add(toAdd);
            source.Merge(new BidirectionalManyToManyInverseApplier());

            source.Collection.Count.Should().Be(1);
            source.Collection.Single().Should().Be.SameInstanceAs(toAdd);
        }
Esempio n. 6
0
        public void WhenSecondIsNullThenReturnFirstCleanedOfDuplications()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();

            source.Collection.Add(new ACollectionApplier());
            source.Collection.Add(new ACollectionApplier());

            var mergeResult = source.Merge(null);

            mergeResult.Should().Not.Be.SameInstanceAs(source);
            mergeResult.Collection.Count.Should().Be(1);
        }
Esempio n. 7
0
        public void WhenSecondIsNotNullThenMerge()
        {
            IPatternsAppliersHolder first = new EmptyPatternsAppliersHolder();

            first.Collection.Add(new ACollectionApplier());
            first.RootClass.Add(new ARootClassApplier());

            IPatternsAppliersHolder second = new EmptyPatternsAppliersHolder();

            second.RootClass.Add(new ARootClassApplier());

            var mergeResult = first.Merge(second);

            mergeResult.Collection.Count.Should().Be(1);
            mergeResult.RootClass.Count.Should().Be(1);
        }
        public void WhenApplierIsNullThenNotThrow()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();

            ActionAssert.NotThrow(() => source.Merge <PropertyPath, IPropertyMapper>(null));
        }
Esempio n. 9
0
        public void WhenApplierIsNullThenNotThrow()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();

            Executing.This(() => source.Merge <PropertyPath, IPropertyMapper>(null)).Should().NotThrow();
        }