public void SelectAzureProfileNull() { SelectAzureRMProfileCommand cmdlt = new SelectAzureRMProfileCommand(); // Setup cmdlt.CommandRuntime = commandRuntimeMock; // Act cmdlt.InvokeBeginProcessing(); Assert.Throws<ArgumentException>(() => cmdlt.ExecuteCmdlet()); cmdlt.InvokeEndProcessing(); }
public void SelectAzureProfileInMemory() { var profile = new AzureRMProfile(); profile.Environments.Add("foo", AzureEnvironment.PublicEnvironments.Values.FirstOrDefault()); SelectAzureRMProfileCommand cmdlt = new SelectAzureRMProfileCommand(); // Setup cmdlt.Profile = profile; cmdlt.CommandRuntime = commandRuntimeMock; // Act cmdlt.InvokeBeginProcessing(); cmdlt.ExecuteCmdlet(); cmdlt.InvokeEndProcessing(); // Verify Assert.True(AzureRmProfileProvider.Instance.Profile.Environments.ContainsKey("foo")); }
public void SelectAzureProfileBadPath() { SelectAzureRMProfileCommand cmdlt = new SelectAzureRMProfileCommand(); cmdlt.Path = "z:\non-existent-path\non-existent-file.ext"; // Setup cmdlt.CommandRuntime = commandRuntimeMock; // Act cmdlt.InvokeBeginProcessing(); Assert.Throws<PSArgumentException>(() => cmdlt.ExecuteCmdlet()); }