public void ApplyCallsAcceptOnAllConventionsAgainstEachClass()
        {
            var conventions = new[]
            {
                MockRepository.GenerateMock<IJoinedSubclassConvention>(),
                MockRepository.GenerateMock<IJoinedSubclassConvention>()
            };
            var id = MockRepository.GenerateStub<IJoinedSubclass>();

            conventionFinder.Stub(x => x.Find<IJoinedSubclassConvention>())
                .Return(conventions);

            convention.Apply(id);

            conventions[0].AssertWasCalled(x => x.Accept(id));
            conventions[1].AssertWasCalled(x => x.Accept(id));
        }
        public void ApplyCallsAcceptOnAllConventionsAgainstEachClass()
        {
            var conventions = new[]
            {
                MockRepository.GenerateMock<IReferenceConvention>(),
                MockRepository.GenerateMock<IReferenceConvention>()
            };
            var relationship = MockRepository.GenerateStub<IManyToOnePart>();

            conventionFinder.Stub(x => x.Find<IReferenceConvention>())
                .Return(conventions);

            convention.Apply(relationship);

            conventions[0].AssertWasCalled(x => x.Accept(relationship));
            conventions[1].AssertWasCalled(x => x.Accept(relationship));
        }
        public void ApplyCallsAcceptOnAllConventionsAgainstEachClass()
        {
            var conventions = new[]
            {
                MockRepository.GenerateMock<IPropertyConvention>(),
                MockRepository.GenerateMock<IPropertyConvention>()
            };
            var property = MockRepository.GenerateStub<IProperty>();

            conventionFinder.Stub(x => x.Find<IPropertyConvention>())
                .Return(conventions);

            convention.Apply(property);

            conventions[0].AssertWasCalled(x => x.Accept(property));
            conventions[1].AssertWasCalled(x => x.Accept(property));
        }
        public void ApplyAppliesAllAcceptedConventions()
        {
            var conventions = new[]
            {
                MockRepository.GenerateMock<IJoinedSubclassConvention>(),
                MockRepository.GenerateMock<IJoinedSubclassConvention>()
            };
            var id = MockRepository.GenerateStub<IJoinedSubclass>();

            conventionFinder.Stub(x => x.Find<IJoinedSubclassConvention>())
                .Return(conventions);

            conventions[0].Stub(x => x.Accept(id)).Return(true);
            conventions[1].Stub(x => x.Accept(id)).Return(false);

            convention.Apply(id);

            // each convention gets Apply called for any properties it returned true for Accept
            conventions[0].AssertWasCalled(x => x.Apply(id));
            conventions[1].AssertWasNotCalled(x => x.Apply(id));
        }
        public void ApplyAppliesAllAcceptedConventions()
        {
            var conventions = new[]
            {
                MockRepository.GenerateMock<IReferenceConvention>(),
                MockRepository.GenerateMock<IReferenceConvention>()
            };
            var relationship = MockRepository.GenerateStub<IManyToOnePart>();

            conventionFinder.Stub(x => x.Find<IReferenceConvention>())
                .Return(conventions);

            conventions[0].Stub(x => x.Accept(relationship)).Return(true);
            conventions[1].Stub(x => x.Accept(relationship)).Return(false);

            convention.Apply(relationship);

            // each convention gets Apply called for any properties it returned true for Accept
            conventions[0].AssertWasCalled(x => x.Apply(relationship));
            conventions[1].AssertWasNotCalled(x => x.Apply(relationship));
        }