public void DisableAutoSsaveWhenDisabled()
 {
     ResetState();
     try
     {
         var cmdlet = new DisableAzureRmContextAutosave();
         cmdlet.Scope          = Commands.Profile.Common.ContextModificationScope.Process;
         cmdlet.CommandRuntime = commandRuntimeMock;
         cmdlet.InvokeBeginProcessing();
         cmdlet.ExecuteCmdlet();
         cmdlet.InvokeEndProcessing();
         Assert.Equal(ContextSaveMode.Process, AzureSession.Instance.ARMContextSaveMode);
         Assert.Equal(typeof(AuthenticationStoreTokenCache), AzureSession.Instance.TokenCache.GetType());
         Assert.Equal(typeof(ResourceManagerProfileProvider), AzureRmProfileProvider.Instance.GetType());
     }
     finally
     {
         ResetState();
     }
 }
示例#2
0
 public void DisableAutoSsaveWhenDisabled()
 {
     ResetState();
     try
     {
         var cmdlet = new DisableAzureRmContextAutosave();
         cmdlet.Scope          = Commands.Profile.Common.ContextModificationScope.Process;
         cmdlet.CommandRuntime = commandRuntimeMock;
         cmdlet.InvokeBeginProcessing();
         cmdlet.ExecuteCmdlet();
         cmdlet.InvokeEndProcessing();
         Assert.Equal(ContextSaveMode.Process, AzureSession.Instance.ARMContextSaveMode);
         Assert.True(AzureSession.Instance.TryGetComponent(PowerShellTokenCacheProvider.PowerShellTokenCacheProviderKey, out PowerShellTokenCacheProvider factory));
         Assert.Equal(typeof(InMemoryTokenCacheProvider), factory.GetType());
         Assert.Equal(typeof(ResourceManagerProfileProvider), AzureRmProfileProvider.Instance.GetType());
     }
     finally
     {
         ResetState();
     }
 }