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);
        }
        public void WhenExistWithSameNameThenRemoveAndAdd()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();

            var domainInspector = new Mock <IDomainInspector>();
            var toRemove        = new ConfOrm.Patterns.BidirectionalManyToManyInverseApplier(domainInspector.Object);

            source.Collection.Add(toRemove);

            var toAdd = new BidirectionalManyToManyInverseApplier();

            source.UnionWith(toAdd);
            source.Collection.Count.Should().Be(1);
            source.Collection.Single().Should().Be.SameInstanceAs(toAdd);
        }
        public void WhenSecondIsNotNullThenUnion()
        {
            IPatternsAppliersHolder first = new EmptyPatternsAppliersHolder();

            var domainInspector = new Mock <IDomainInspector>();

            first.Collection.Add(new ConfOrm.Patterns.BidirectionalManyToManyInverseApplier(domainInspector.Object));

            IPatternsAppliersHolder second            = new EmptyPatternsAppliersHolder();
            var bidirectionalManyToManyInverseApplier = new BidirectionalManyToManyInverseApplier();

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

            var unionResult = first.UnionWith(second);

            unionResult.Collection.Count.Should().Be(1);
            unionResult.RootClass.Count.Should().Be(1);
            unionResult.Collection.Single().Should().Be.SameInstanceAs(bidirectionalManyToManyInverseApplier);
        }