Exemplo n.º 1
0
 public void Init()
 {
     Console.WriteLine($"Starting augmentation test {TestContext.CurrentContext.Test.Name}...");
     Config       = AzureCPConfig.GetConfiguration(UnitTestsHelper.ClaimsProviderConfigName, UnitTestsHelper.SPTrust.Name);
     BackupConfig = Config.CopyPersistedProperties();
     Config.EnableAugmentation = true;
     Config.Update();
 }
Exemplo n.º 2
0
    public static void InitializeConfiguration(AzureCPConfig config)
    {
        config.ResetCurrentConfiguration();

#if DEBUG
        config.Timeout = 99999;
#endif

        string             json         = File.ReadAllText(AzureTenantsJsonFile);
        List <AzureTenant> azureTenants = JsonConvert.DeserializeObject <List <AzureTenant> >(json);
        config.AzureTenants = azureTenants;
        config.Update();
    }
Exemplo n.º 3
0
    public static void InitializeConfiguration(AzureCPConfig config)
    {
        config.ResetCurrentConfiguration();

#if DEBUG
        config.Timeout = 99999;
#endif

        string             json         = File.ReadAllText(AzureTenantsJsonFile);
        List <AzureTenant> azureTenants = JsonConvert.DeserializeObject <List <AzureTenant> >(json);
        config.AzureTenants = azureTenants;
        config.Update();
        Trace.WriteLine($"{DateTime.Now.ToString("s")} Set {config.AzureTenants.Count} Azure AD tenants to AzureCP configuration");
    }
Exemplo n.º 4
0
        public void ModifyOrDeleteIdentityClaimTypeConfig()
        {
            // Delete identity claim type from ClaimTypes list based on its claim type should throw exception InvalidOperationException
            string identityClaimType = UnitTestsHelper.SPTrust.IdentityClaimTypeInformation.MappedClaimType;

            Assert.Throws <InvalidOperationException>(() => Config.ClaimTypes.Remove(identityClaimType), $"Delete identity claim type from ClaimTypes list should throw exception InvalidOperationException with this message: \"Cannot delete claim type \"{UnitTestsHelper.SPTrust.IdentityClaimTypeInformation.MappedClaimType}\" because it is the identity claim type of \"{UnitTestsHelper.SPTrust.Name}\"\"");

            // Delete identity claim type from ClaimTypes list based on its ClaimTypeConfig should throw exception InvalidOperationException
            ClaimTypeConfig identityCTConfig = Config.ClaimTypes.FirstOrDefault(x => String.Equals(UnitTestsHelper.SPTrust.IdentityClaimTypeInformation.MappedClaimType, x.ClaimType, StringComparison.InvariantCultureIgnoreCase));

            Assert.Throws <InvalidOperationException>(() => Config.ClaimTypes.Remove(identityClaimType), $"Delete identity claim type from ClaimTypes list should throw exception InvalidOperationException with this message: \"Cannot delete claim type \"{UnitTestsHelper.SPTrust.IdentityClaimTypeInformation.MappedClaimType}\" because it is the identity claim type of \"{UnitTestsHelper.SPTrust.Name}\"\"");

            // Modify identity ClaimTypeConfig to set its EntityType to Group should throw exception InvalidOperationException
            identityCTConfig.EntityType = DirectoryObjectType.Group;
            Assert.Throws <InvalidOperationException>(() => Config.Update(), $"Modify identity claim type to set its EntityType to Group should throw exception InvalidOperationException with this message: \"{ConfigUpdateErrorMessage}\"");
        }
Exemplo n.º 5
0
 public void Cleanup()
 {
     Config.ApplyConfiguration(BackupConfig);
     Config.Update();
     Console.WriteLine($"Restored actual configuration.");
 }
Exemplo n.º 6
0
 public void Cleanup()
 {
     Config.ApplyConfiguration(BackupConfig);
     Config.Update();
 }
Exemplo n.º 7
0
 public void Cleanup()
 {
     Config.ApplyConfiguration(BackupConfig);
     Config.Update();
     Trace.WriteLine($"{DateTime.Now.ToString("s")} Restored original settings of AzureCP configuration");
 }