public void ShouldApply_AtLeastOneTrue_True()
        {
            //-- Arrange

            var composite = new CompositeConvention(
                new TestConvention(shouldApply: false),
                new TestConvention(shouldApply: true)
                );

            //-- Act

            var shouldApply = composite.ShouldApply(context: null);

            //-- Assert

            Assert.That(shouldApply, Is.True);
        }
        public void Apply_AllShouldApply_AllApplied()
        {
            //-- Arrange

            var containedConventions = new[] {
                new TestConvention(shouldApply: true),
                new TestConvention(shouldApply: true)
            };

            //-- Act

            var composite = new CompositeConvention(containedConventions);

            composite.Apply(context: null);

            //-- Assert

            Assert.That(containedConventions[0].WasApplied, Is.True);
            Assert.That(containedConventions[1].WasApplied, Is.True);
        }
        public void Apply_SameContextPropagated()
        {
            //-- Arrange

            var containedConventions = new[] {
                new TestConvention(shouldApply: true),
                new TestConvention(shouldApply: true)
            };

            var context = new ObjectFactoryContext(factory: null, typeKey: new TypeKey());

            //-- Act

            var composite = new CompositeConvention(containedConventions);

            composite.Apply(context);

            //-- Assert

            Assert.That(containedConventions[0].ApplyContext, Is.SameAs(context));
            Assert.That(containedConventions[1].ApplyContext, Is.SameAs(context));
        }