Ejemplo n.º 1
0
        public void TestSetGetProfile()
        {
            VaultProfileManager.SetProfile("Test1", "local",
                                           vaultParams: new Dictionary <string, object>
            {
                ["RootPath"] = "zz:\\no\\such\\path"
            });

            var profiles = VaultProfileManager.GetProfileNames();

            Assert.IsNotNull(profiles);
            Assert.IsTrue(profiles.Count() > 0);
            Assert.IsTrue(profiles.Contains("Test1"));

            var p = VaultProfileManager.GetProfile("Test1");

            Assert.IsNotNull(p);
            Assert.AreEqual("Test1", p.Name);
            Assert.AreEqual("local", p.ProviderName);
            Assert.IsNotNull(p.VaultParameters);
            Assert.IsTrue(p.VaultParameters.Count > 0);
            Assert.IsTrue(p.VaultParameters.ContainsKey("RootPath"));

            VaultProfileManager.RemoveProfile("Test1");
            profiles = VaultProfileManager.GetProfileNames();
            Assert.IsNotNull(profiles);
            Assert.IsFalse(profiles.Contains("Test1"));

            p = VaultProfileManager.GetProfile("Test1");
            Assert.IsNull(p);
        }
Ejemplo n.º 2
0
        public void TestGetProfiles()
        {
            var profiles = VaultProfileManager.GetProfileNames();

            Assert.IsNotNull(profiles);
            Assert.IsTrue(profiles.Count() > 0);

            var builtinProfiles = profiles.Where(x => x.StartsWith(":"))
                                  .Select(x => VaultProfileManager.GetProfile(x));

            Assert.IsTrue(builtinProfiles.Count() > 0);
        }
Ejemplo n.º 3
0
 protected override void ProcessRecord()
 {
     if (ListProfiles)
     {
         WriteObject(VaultProfileManager.GetProfileNames(), true);
     }
     else
     {
         var profileName = VaultProfileManager.ResolveProfileName(ProfileName);
         WriteObject(VaultProfileManager.GetProfile(profileName));
     }
 }