Exemplo n.º 1
0
        public void GetUPNFromAccountTest()
        {
            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateOnPremisesClientContext())
                {
                    PublishingPageTransformationInformation pti = new PublishingPageTransformationInformation()
                    {
                        // If target page exists, then overwrite it
                        Overwrite = true,

                        // Don't log test runs
                        SkipTelemetry = true,

                        //Permissions are should work given cross domain with mapping
                        KeepPageSpecificPermissions = true,

                        // Replace User Mapping
                        UserMappingFile = @"..\..\Transform\Mapping\usermapping_sample.csv"
                    };

                    UserTransformator userTransformator = new UserTransformator(pti, sourceClientContext, targetClientContext, null);

                    var result = userTransformator.SearchSourceDomainForUPN(AccountType.User, "test.user3");
                    Console.WriteLine(result);

                    Assert.IsTrue(!string.IsNullOrEmpty(result));
                }
            }
        }
Exemplo n.º 2
0
        public void GetUPNFromGroupWithSIDTest()
        {
            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateOnPremisesClientContext())
                {
                    PublishingPageTransformationInformation pti = new PublishingPageTransformationInformation()
                    {
                        // If target page exists, then overwrite it
                        Overwrite = true,
                        // Don't log test runs
                        SkipTelemetry = true,
                        //Permissions are should work given cross domain with mapping
                        KeepPageSpecificPermissions = true,
                        // Replace User Mapping
                        UserMappingFile = @"..\..\Transform\Mapping\usermapping_sample.csv"
                    };

                    UserTransformator userTransformator = new UserTransformator(pti, sourceClientContext, targetClientContext, null);

                    // SharePoint-Readers (note specific to PBs test rig)
                    var result = userTransformator.SearchSourceDomainForUPN(AccountType.Group, "s-1-5-21-2364077317-3999105188-691961326-1129");
                    Console.WriteLine(result);

                    Assert.IsTrue(!string.IsNullOrEmpty(result));
                }
            }
        }
Exemplo n.º 3
0
        public void GetUPNFromAccountWithCustomLDAPPositiveTest()
        {
            var ldap = "LDAP://OU=CDT,OU=Demo Users,DC=AlphaDelta,DC=Local";

            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateOnPremisesClientContext())
                {
                    PublishingPageTransformationInformation pti = new PublishingPageTransformationInformation()
                    {
                        // If target page exists, then overwrite it
                        Overwrite = true,

                        // Don't log test runs
                        SkipTelemetry = true,

                        //Permissions are should work given cross domain with mapping
                        KeepPageSpecificPermissions = true,

                        LDAPConnectionString = ldap
                    };

                    UserTransformator userTransformator = new UserTransformator(pti, sourceClientContext, targetClientContext, null);

                    var result = userTransformator.SearchSourceDomainForUPN(AccountType.User, "Cara.Irvine"); //User Outside of LDAP Connection String
                    Console.WriteLine(result);

                    Assert.IsTrue(!string.IsNullOrEmpty(result));
                }
            }
        }