Exemple #1
0
        public AzurePowerShellCertificateTest(params string[] modules)
            : base(AzureModule.AzureServiceManagement, modules)
        {
            this.runningMocked            = (HttpMockServer.GetCurrentMode() == HttpRecorderMode.Playback);
            TestMockSupport.RunningMocked = this.runningMocked;
            if (this.runningMocked)
            {
                AzureSession.Instance.AuthenticationFactory = new MockTokenAuthenticationFactory();
                string dummyCredentialFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, TestCredentialHelper.DefaultCredentialFile);
                if (!File.Exists(dummyCredentialFile))
                {
                    AzureSession.Instance.DataStore.WriteFile(dummyCredentialFile, Resources.RdfeTestDummy);
                }
                this.credentialFile = dummyCredentialFile;
            }
            else
            {
                this.credentials    = new TestCredentialHelper(AppDomain.CurrentDomain.BaseDirectory);
                this.credentialFile = TestCredentialHelper.DefaultCredentialFile;
                this.profileFile    = TestCredentialHelper.WindowsAzureProfileFile;
            }
            AzureSession.Instance.DataStore = new MemoryDataStore();

            if (Environment.GetEnvironmentVariable(outputDirKey) != null)
            {
                HttpMockServer.RecordsDirectory = Environment.GetEnvironmentVariable(outputDirKey);
            }
        }
        public AzurePowerShellCertificateTest(params string[] modules)
            : base(AzureModule.AzureServiceManagement, modules)
        {
            this.runningMocked = (HttpMockServer.GetCurrentMode() == HttpRecorderMode.Playback);
            TestMockSupport.RunningMocked = this.runningMocked;
            if (this.runningMocked)
            {
                AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory();
                string dummyCredentialFile = Path.Combine(Environment.CurrentDirectory, TestCredentialHelper.DefaultCredentialFile);
                if (!File.Exists(dummyCredentialFile))
                {
                    ProfileClient.DataStore.WriteFile(dummyCredentialFile, Properties.Resources.RdfeTestDummy);
                }
                this.credentialFile = dummyCredentialFile;
            }
            else
            {
                this.credentials = new TestCredentialHelper(Environment.CurrentDirectory);
                this.credentialFile = TestCredentialHelper.DefaultCredentialFile;
                this.profileFile = TestCredentialHelper.WindowsAzureProfileFile;
            }
            ProfileClient.DataStore = new MockDataStore();

            if (Environment.GetEnvironmentVariable(outputDirKey) != null)
            {
                HttpMockServer.RecordsDirectory = Environment.GetEnvironmentVariable(outputDirKey);
            }
        }
Exemple #3
0
        public WindowsAzurePowerShellCertificateTest(params string[] modules)
            : base(AzureModule.AzureServiceManagement, modules)
        {
            this.runningMocked            = (HttpMockServer.GetCurrentMode() == HttpRecorderMode.Playback);
            TestMockSupport.RunningMocked = this.runningMocked;
            if (this.runningMocked)
            {
                string dummyCredentialFile = Path.Combine(Environment.CurrentDirectory, TestCredentialHelper.DefaultCredentialFile);
                if (!File.Exists(dummyCredentialFile))
                {
                    File.WriteAllText(dummyCredentialFile, Properties.Resources.RdfeTestDummy);
                }
                this.credentialFile = dummyCredentialFile;
            }
            else
            {
                this.credentials    = new TestCredentialHelper(Environment.CurrentDirectory);
                this.credentialFile = TestCredentialHelper.DefaultCredentialFile;
                this.profileFile    = TestCredentialHelper.WindowsAzureProfileFile;
            }

            if (Environment.GetEnvironmentVariable(outputDirKey) != null)
            {
                HttpMockServer.RecordsDirectory = Environment.GetEnvironmentVariable(outputDirKey);
            }
        }
 public WindowsAzurePowerShellCertificateTest(params string[] modules)
     : base(modules)
 {
     this.credentials    = new TestCredentialHelper(Environment.CurrentDirectory);
     this.credentialFile = TestCredentialHelper.DefaultCredentialFile;
     this.profileFile    = TestCredentialHelper.WindowsAzureProfileFile;
 }
 public WindowsAzurePowerShellCertificateTest(params string[] modules)
     : base(modules)
 {
     this.credentials = new TestCredentialHelper(Environment.CurrentDirectory);
     this.credentialFile = TestCredentialHelper.DefaultCredentialFile;
     this.profileFile = TestCredentialHelper.WindowsAzureProfileFile;
 }
        public WindowsAzurePowerShellCertificateTest(params string[] modules)
            : base(modules)
        {
            this.credentials = new TestCredentialHelper(Environment.CurrentDirectory);
            this.credentialFile = TestCredentialHelper.DefaultCredentialFile;
            this.profileFile = TestCredentialHelper.WindowsAzureProfileFile;

            if (Environment.GetEnvironmentVariable(outputDirKey) != null)
            {
                HttpMockServer.RecordsDirectory = Environment.GetEnvironmentVariable(outputDirKey);
            }
        }
Exemple #7
0
 public override void TestSetup()
 {
     base.TestSetup();
     if (this.runningMocked)
     {
         TestCredentialHelper.ImportCredentails(powershell, this.credentialFile);
     }
     else
     {
         this.credentials.SetupPowerShellEnvironment(powershell, this.credentialFile, this.profileFile);
         System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) =>
         {
             return(true);
         };
     }
 }