Exemple #1
0
 public void TestDateNegative()
 {
     Assert.Equal(string.Empty, PSAzureServiceProfile.GetDateString("profile-foo"));
     Assert.Equal(string.Empty, PSAzureServiceProfile.GetDateString("profile2019-20"));
     Assert.Equal(string.Empty, PSAzureServiceProfile.GetDateString("profile-2019-20"));
     Assert.Equal(string.Empty, PSAzureServiceProfile.GetDateString("profile-20-30-40"));
     Assert.Equal(string.Empty, PSAzureServiceProfile.GetDateString("profile-20195-30-40"));
 }
Exemple #2
0
        public void TestDescription(string name, string profileType, string month, string year)
        {
            string expected = Resources.ProdProfileDescription;;

            switch (profileType)
            {
            case "Hybrid":
                expected = Resources.HybridProfileDescription;
                break;

            case "Sovereign":
                expected = Resources.SovereignProfileDescription;
                break;
            }

            var expectedReturnValue = $"{expected} This profile was defined in {month} {year}.";

            Assert.Equal(expectedReturnValue, PSAzureServiceProfile.GetProfileDescription(name));
        }
 protected override void ProcessRecord()
 {
     try
     {
         var includesModuleNames = this.IsBound(nameof(ModuleName));
         var isListAvailable     = this.IsBound(nameof(ListAvailable));
         var moduleNames         = includesModuleNames ? ModuleName : new string[] { };
         var profiles            = includesModuleNames || isListAvailable
             ? GetProfiles(InvokeCommand, isListAvailable, moduleNames)
             : new [] { ContextAdapter.Instance.SelectedProfile };
         if (profiles.Any((p) => !string.IsNullOrWhiteSpace(p)))
         {
             WriteObject(profiles.Where((profile) => !string.IsNullOrWhiteSpace(profile))
                         .Select((p) => PSAzureServiceProfile.Create(p)), true);
         }
     }
     catch (Exception exception)
     {
         // Write exception out to error channel.
         WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
     }
 }
Exemple #4
0
 public void TestDescriptionNegative(string name)
 {
     Assert.Equal(Resources.ProdProfileDescription, PSAzureServiceProfile.GetProfileDescription(name));
 }
Exemple #5
0
        public void TestDate(string profile, string month, string year)
        {
            var expectedDateString = $" This profile was defined in {month} {year}.";

            Assert.Equal(expectedDateString, PSAzureServiceProfile.GetDateString(profile));
        }