Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void ShouldApply_SameContextPropagated()
        {
            //-- Arrange

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

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

            //-- Act

            var composite = new CompositeConvention(containedConventions);

            composite.ShouldApply(context);

            //-- Assert

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