Example #1
0
        public void LongPath()
        {
            using (var container = new RhetosTestContainer())
            {
                var repository = container.Resolve <Common.DomRepository>();
                repository.TestHierarchy.WithPath.Delete(repository.TestHierarchy.WithPath.Query());

                var h1 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = new string('a', 256), GroupID = null
                };
                var h2 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = new string('b', 256), GroupID = h1.ID
                };
                var h3 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = new string('c', 256), GroupID = h2.ID
                };

                repository.TestHierarchy.WithPath.Insert(h1, h2, h3);

                var paths = repository.TestHierarchy.WithPathGroupHierarchy.Query()
                            .Select(h => new { h.ID, h.GroupSequence })
                            .ToList()
                            .ToDictionary(h => h.ID, h => h.GroupSequence);

                Assert.AreEqual("aaa...(256)", TestUtility.CompressReport(paths[h1.ID]));
                Assert.AreEqual("aaa...(256) - bbb...(256)", TestUtility.CompressReport(paths[h2.ID]));
                Assert.AreEqual("aaa...(256) - bbb...(256) - ccc...(256)", TestUtility.CompressReport(paths[h3.ID]));
            }
        }
Example #2
0
        public void Path()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve <ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestHierarchy.WithPath" });
                var repository = container.Resolve <Common.DomRepository>();

                var h1 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = "h1", GroupID = null
                };
                var h11 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = "h11", GroupID = h1.ID
                };
                var h12 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = "h12", GroupID = h1.ID
                };
                var h121 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = "h121", GroupID = h12.ID
                };
                var h2 = new TestHierarchy.WithPath {
                    ID = Guid.NewGuid(), Title = "h2", GroupID = null
                };

                repository.TestHierarchy.WithPath.Insert(new[] { h1, h11, h12, h121, h2 });

                Assert.AreEqual("h1, h1 - h11, h1 - h12, h1 - h12 - h121, h2",
                                TestUtility.DumpSorted(repository.TestHierarchy.BrowseWithPath.All(), item => item.GroupSequence));
            }
        }
Example #3
0
        public void Path()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                executionContext.SqlExecuter.ExecuteSql(new[] { "DELETE FROM TestHierarchy.WithPath" });
                var repository = new Common.DomRepository(executionContext);

                var h1 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h1", Group = null };
                var h11 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h11", Group = h1 };
                var h12 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h12", Group = h1 };
                var h121 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h121", Group = h12 };
                var h2 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h2", Group = null };

                repository.TestHierarchy.WithPath.Insert(new[] { h1, h11, h12, h121, h2 });

                Assert.AreEqual("h1, h1 - h11, h1 - h12, h1 - h12 - h121, h2",
                    TestUtility.DumpSorted(repository.TestHierarchy.BrowseWithPath.All(), item => item.GroupSequence));

            }
        }
Example #4
0
        public void Path()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestHierarchy.WithPath" });
                var repository = container.Resolve<Common.DomRepository>();

                var h1 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h1", Group = null };
                var h11 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h11", Group = h1 };
                var h12 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h12", Group = h1 };
                var h121 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h121", Group = h12 };
                var h2 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = "h2", Group = null };

                repository.TestHierarchy.WithPath.Insert(new[] { h1, h11, h12, h121, h2 });

                Assert.AreEqual("h1, h1 - h11, h1 - h12, h1 - h12 - h121, h2",
                    TestUtility.DumpSorted(repository.TestHierarchy.BrowseWithPath.All(), item => item.GroupSequence));

            }
        }
Example #5
0
        public void LongPath()
        {
            using (var container = new RhetosTestContainer())
            {
                var repository = container.Resolve<Common.DomRepository>();
                repository.TestHierarchy.WithPath.Delete(repository.TestHierarchy.WithPath.Query());

                var h1 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = new string('a', 256), GroupID = null };
                var h2 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = new string('b', 256), GroupID = h1.ID };
                var h3 = new TestHierarchy.WithPath { ID = Guid.NewGuid(), Title = new string('c', 256), GroupID = h2.ID };

                repository.TestHierarchy.WithPath.Insert(h1, h2, h3);

                var paths = repository.TestHierarchy.WithPathGroupHierarchy.Query()
                    .Select(h => new { h.ID, h.GroupSequence })
                    .ToList()
                    .ToDictionary(h => h.ID, h => h.GroupSequence);

                Assert.AreEqual("aaa...(256)", TestUtility.CompressReport(paths[h1.ID]));
                Assert.AreEqual("aaa...(256) - bbb...(256)", TestUtility.CompressReport(paths[h2.ID]));
                Assert.AreEqual("aaa...(256) - bbb...(256) - ccc...(256)", TestUtility.CompressReport(paths[h3.ID]));

            }
        }