Exemplo n.º 1
0
        public void ValidateTermById_NegativeTest()
        {
            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPODevSiteUrl")))
                {
                    TermTransformator termTransformator = new TermTransformator(null, sourceClientContext, targetClientContext);

                    // Target - Katchup - dc2cca62-cf9a-4a61-b672-4aa7d0b6a179
                    // Source - Categories - e757dcf5-f443-42e9-98c6-5842861099cb (site collection term set)
                    termTransformator.CacheTermsFromTermStore(
                        new Guid("e757dcf5-f443-42e9-98c6-5842861099cb"),
                        new Guid("dc2cca62-cf9a-4a61-b672-4aa7d0b6a179"), Guid.Empty, false);

                    // Need to have the term store populated values
                    // Announcements
                    var result = termTransformator.ResolveTermInCache(sourceClientContext, new Guid("11111111-2222-3333-4444-0970abd1029d"));

                    Assert.IsTrue(result == default);
                }
            }
        }
Exemplo n.º 2
0
        public void ValidateTermById_PositiveTest()
        {
            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPODevSiteUrl")))
                {
                    TermTransformator termTransformator = new TermTransformator(null, sourceClientContext, targetClientContext);

                    // Target - Katchup - dc2cca62-cf9a-4a61-b672-4aa7d0b6a179
                    // Source - Categories - e757dcf5-f443-42e9-98c6-5842861099cb (site collection term set)
                    termTransformator.CacheTermsFromTermStore(
                        new Guid("e757dcf5-f443-42e9-98c6-5842861099cb"),
                        new Guid("dc2cca62-cf9a-4a61-b672-4aa7d0b6a179"), Guid.Empty, false);

                    // Need to have the term store populated values
                    var result        = termTransformator.ResolveTermInCache(sourceClientContext, new Guid("ac625b0a-0459-4d23-bc96-0970abd1029d"));
                    var expectedLabel = "Announcements";

                    Assert.AreEqual(expectedLabel, result.TermLabel);
                }
            }
        }
Exemplo n.º 3
0
        public void CacheTermStoreTenantStoreTest()
        {
            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPODevSiteUrl")))
                {
                    TermTransformator termTransformator = new TermTransformator(null, sourceClientContext, targetClientContext);

                    // Target - Katchup - dc2cca62-cf9a-4a61-b672-4aa7d0b6a179
                    // Source - Categories - e757dcf5-f443-42e9-98c6-5842861099cb (site collection term set)
                    termTransformator.CacheTermsFromTermStore(
                        new Guid("e757dcf5-f443-42e9-98c6-5842861099cb"),
                        new Guid("dc2cca62-cf9a-4a61-b672-4aa7d0b6a179"), Guid.Empty, false);

                    // Need to have the term store populated values
                    var result        = Cache.CacheManager.Instance.GetTransformTermCacheTermById(sourceClientContext, new Guid("c9cbb11b-77ed-4890-ae24-ee103002c46b"));
                    var expectedLabel = "PnPTransform";

                    Assert.AreEqual(expectedLabel, result.TermLabel);
                }
            }
        }
Exemplo n.º 4
0
        public void GetTermSetPathsTest()
        {
            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPODevSiteUrl")))
                {
                    TermTransformator termTransformator = new TermTransformator(null, sourceClientContext, targetClientContext);

                    // Target - Katchup - dc2cca62-cf9a-4a61-b672-4aa7d0b6a179
                    // Source - Categories - e757dcf5-f443-42e9-98c6-5842861099cb (site collection term set)
                    termTransformator.CacheTermsFromTermStore(
                        new Guid("e757dcf5-f443-42e9-98c6-5842861099cb"),
                        new Guid("dc2cca62-cf9a-4a61-b672-4aa7d0b6a179"), Guid.Empty, false);

                    var results = TermTransformator.GetAllTermsFromTermSet(new Guid("e757dcf5-f443-42e9-98c6-5842861099cb"), sourceClientContext);
                    foreach (var result in results)
                    {
                        Console.WriteLine($"ID: {result.Key} {result.Value.TermPath}");
                    }

                    Assert.IsTrue(results.Count > 0); //Super simple
                }
            }
        }
Exemplo n.º 5
0
        public void CacheTermStoreSiteCollectionByNameTest()
        {
            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPODevSiteUrl")))
                {
                    TermTransformator termTransformator = new TermTransformator(null, sourceClientContext, targetClientContext);

                    // Target - Katchup - dc2cca62-cf9a-4a61-b672-4aa7d0b6a179
                    // Source - Categories - e757dcf5-f443-42e9-98c6-5842861099cb (site collection term set)
                    termTransformator.CacheTermsFromTermStore(
                        new Guid("e757dcf5-f443-42e9-98c6-5842861099cb"),
                        new Guid("dc2cca62-cf9a-4a61-b672-4aa7d0b6a179"), Guid.Empty, false);

                    // Need to have the term store populated values
                    var expectedLabel = "Announcements";
                    var result        = Cache.CacheManager.Instance.GetTransformTermCacheTermByName(sourceClientContext, expectedLabel);

                    Assert.IsTrue(result.Count > 0);

                    result.ForEach(o => Console.WriteLine("Cached Term: {0} {1} ", o.TermSetId, o.TermPath, o.TermLabel));
                }
            }
        }