// Deps: BASIC and DB TEST test configs
        public void GetRootItems_ReturnsExpectedRootValues()
        {
            var predicate = new SerializationPresetPredicate(CreateTestConfiguration(), null, null);

            var roots = predicate.GetRootPaths();

            roots.Length.Should().Be(11);
            roots[0].DatabaseName.Should().Be("master");
            roots[0].Path.Should().Be("/sitecore/layout/Simulators");
            roots[7].DatabaseName.Should().Be("core");
            roots[7].Path.Should().Be("/sitecore/coredb");
        }
        // Deps: BASIC and DB TEST test configs
        public void GetRootItems_ReturnsExpectedRootValues()
        {
            var predicate = new SerializationPresetPredicate(CreateTestConfiguration(), null, null);

            var roots = predicate.GetRootPaths();

            roots.Length.Should().Be(14);

            var basicRoot = roots.FirstOrDefault(root => root.Name.Equals("Basic"));

            basicRoot?.DatabaseName.Should().Be("master");
            basicRoot?.Path.Should().Be("/sitecore/layout/Simulators");

            var dbTestRoot = roots.FirstOrDefault(root => root.Name.Equals("DB test"));

            dbTestRoot?.DatabaseName.Should().Be("core");
            dbTestRoot?.Path.Should().Be("/sitecore/coredb");
        }
Пример #3
0
        public void GetRootItems_ReturnsExpectedRootValues()
        {
            var sourceItem1 = new FakeItem();
            var sourceItem2 = new FakeItem();

            var sourceDataProvider = Substitute.For <IDataStore>();

            sourceDataProvider.GetByPath("master", "/sitecore/layout/Simulators").Returns(new[] { sourceItem1 });
            sourceDataProvider.GetByPath("core", "/sitecore/content").Returns(new[] { sourceItem2 });

            var predicate = new SerializationPresetPredicate(CreateTestConfiguration());

            var roots = predicate.GetRootPaths();

            Assert.True(roots.Length == 3, "Expected three root paths from test config");
            Assert.Equal(roots[0].DatabaseName, "master");
            Assert.Equal(roots[0].Path, "/sitecore/layout/Simulators");
            Assert.Equal(roots[1].DatabaseName, "core");
            Assert.Equal(roots[1].Path, "/sitecore/content");
        }
        public void GetRootItems_ReturnsExpectedRootValues()
        {
            var sourceItem1 = new Mock <ISourceItem>();
            var sourceItem2 = new Mock <ISourceItem>();

            var sourceDataProvider = new Mock <ISourceDataProvider>();

            sourceDataProvider.Setup(x => x.GetItemByPath("master", "/sitecore/layout/Simulators")).Returns(sourceItem1.Object);
            sourceDataProvider.Setup(x => x.GetItemByPath("core", "/sitecore/content")).Returns(sourceItem2.Object);

            var predicate = new SerializationPresetPredicate(CreateTestConfiguration());

            var roots = predicate.GetRootPaths();

            Assert.IsTrue(roots.Length == 2, "Expected two root paths from test config");
            Assert.AreEqual(roots[0].Database, "master", "Expected first root to be in master db");
            Assert.AreEqual(roots[0].Path, "/sitecore/layout/Simulators", "Expected first root to be /sitecore/layout/Simulators");
            Assert.AreEqual(roots[1].Database, "core", "Expected second root to be in core db");
            Assert.AreEqual(roots[1].Path, "/sitecore/content", "Expected second root to be /sitecore/content");
        }