public void ConstructForeignKeySetterFixture()
        {
            var action = TestRepositoryHelper.ConstructForeignKeyTrigger<TestModel6>("TestModelObject", "TestId");
            var model = new TestModel6() { TestId = 2 };
            action(model);
            model.TestId.Should().Equal(2);
            model.TestModelObject.Should().Not.Be.Null();
            model.TestModelObject.TestId.Should().Equal(2);

            model = new TestModel6() { TestModelObject = new TestModel5() { TestId = 3 } };
            action(model);
            model.TestId.Should().Equal(3);

        }
示例#2
0
        public void ConstructForeignKeySetterFixture()
        {
            var action = TestRepositoryHelper.ConstructForeignKeyTrigger <TestModel6>("TestModelObject", "TestId");
            var model  = new TestModel6()
            {
                TestId = 2
            };

            action(model);
            model.TestId.Should().Equal(2);
            model.TestModelObject.Should().Not.Be.Null();
            model.TestModelObject.TestId.Should().Equal(2);

            model = new TestModel6()
            {
                TestModelObject = new TestModel5()
                {
                    TestId = 3
                }
            };
            action(model);
            model.TestId.Should().Equal(3);
        }