Exemple #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]));
            }
        }