public void EnableAutosaveWhenDisabled()
 {
     ResetState();
     try
     {
         var cmdlet = new EnableAzureRmContextAutosave();
         cmdlet.Scope          = Commands.Profile.Common.ContextModificationScope.Process;
         cmdlet.CommandRuntime = commandRuntimeMock;
         cmdlet.InvokeBeginProcessing();
         cmdlet.ExecuteCmdlet();
         cmdlet.InvokeEndProcessing();
         Assert.Equal(ContextSaveMode.CurrentUser, AzureSession.Instance.ARMContextSaveMode);
         Assert.Equal(typeof(ProtectedFileTokenCache), AzureSession.Instance.TokenCache.GetType());
         Assert.Equal(typeof(ProtectedProfileProvider), AzureRmProfileProvider.Instance.GetType());
     }
     finally
     {
         ResetState();
     }
 }
Example #2
0
 public void EnableAutosaveWhenDisabled()
 {
     ResetState();
     try
     {
         var cmdlet = new EnableAzureRmContextAutosave();
         cmdlet.Scope          = Commands.Profile.Common.ContextModificationScope.Process;
         cmdlet.CommandRuntime = commandRuntimeMock;
         cmdlet.InvokeBeginProcessing();
         cmdlet.ExecuteCmdlet();
         cmdlet.InvokeEndProcessing();
         Assert.Equal(ContextSaveMode.CurrentUser, AzureSession.Instance.ARMContextSaveMode);
         Assert.Equal(typeof(ProtectedProfileProvider), AzureRmProfileProvider.Instance.GetType());
     }
     catch (PlatformNotSupportedException)
     {
         // swallow exception when test env (Linux server) doesn't support token cache persistence
     }
     finally
     {
         ResetState();
     }
 }