Exemple #1
0
        protected static void SetCLIEnv(TestContext testContext)
        {
            //add the language specific initialization
            lang = AgentFactory.GetLanguage(testContext.Properties);

            isMooncake = Utility.GetTargetEnvironment().Name == "AzureChinaCloud";

            string mode = Test.Data.Get("IsResourceMode");

            if (!string.IsNullOrEmpty(mode))
            {
                isResourceMode = bool.Parse(mode);
            }

            if (lang == Language.PowerShell)
            {
                if (isResourceMode)
                {
                    PowerShellAgent.ImportModules(Constants.ResourceModulePaths);;
                }
                else
                {
                    PowerShellAgent.ImportModules(Constants.ServiceModulePaths);
                }

                string snapInName = Test.Data.Get("PSSnapInName");
                if (!string.IsNullOrWhiteSpace(snapInName))
                {
                    PowerShellAgent.AddSnapIn(snapInName);
                }

                //set the default storage context
                PowerShellAgent.SetStorageContext(StorageAccount.ToString(true));
            }
            else if (lang == Language.NodeJS)
            {
                NodeJSAgent.GetOSConfig(Test.Data);

                // use ConnectionString parameter by default in function test
                NodeJSAgent.AgentConfig.ConnectionString = StorageAccount.ToString(true);

                FileUtil.GetOSConfig(Test.Data);
            }
        }