Exemplo n.º 1
0
        public void SubtypeInDifferentModule()
        {
            using (var container = new RhetosTestContainer())
            {
                var repositories = container.Resolve <GenericRepositories>();

                var subtype1 = new TestPolymorphic.DifferentModule {
                    ID = Guid.NewGuid(), Code = "a"
                };
                var subtype2 = new TestPolymorphic2.DifferentModule {
                    ID = Guid.NewGuid(), Code = "b"
                };

                repositories.Save(new[] { subtype1 }, null, repositories.Load <TestPolymorphic.DifferentModule>());
                repositories.Save(new[] { subtype2 }, null, repositories.Load <TestPolymorphic2.DifferentModule>());

                Assert.AreEqual(
                    "TestPolymorphic.DifferentModule a1, TestPolymorphic2.DifferentModule b2",
                    TestUtility.DumpSorted(repositories.Query <TestPolymorphic.DifferentModuleBase>(), item => item.Subtype + " " + item.Name));
            }
        }
Exemplo n.º 2
0
        public void SubtypeInDifferentModule()
        {
            using (var container = new RhetosTestContainer())
            {
                var repositories = container.Resolve<GenericRepositories>();

                var subtype1 = new TestPolymorphic.DifferentModule { ID = Guid.NewGuid(), Code = "a" };
                var subtype2 = new TestPolymorphic2.DifferentModule { ID = Guid.NewGuid(), Code = "b" };

                repositories.Save(new[] { subtype1 }, null, repositories.Load<TestPolymorphic.DifferentModule>());
                repositories.Save(new[] { subtype2 }, null, repositories.Load<TestPolymorphic2.DifferentModule>());

                Assert.AreEqual(
                    "TestPolymorphic.DifferentModule a1, TestPolymorphic2.DifferentModule b2",
                    TestUtility.DumpSorted(repositories.Query<TestPolymorphic.DifferentModuleBase>(), item => item.Subtype + " " + item.Name));
            }
        }