Example #1
0
        internal virtual void TestInitialize([System.Runtime.CompilerServices.CallerMemberName] string methodName = "testframework_failed")
        {
            Context                   = HDInsightMockContext.Start(this.GetType().FullName, methodName);
            CommonData                = new CommonTestFixture();
            HDInsightClient           = Context.GetServiceClient <HDInsightManagementClient>();
            HDInsightManagementHelper = new HDInsightManagementHelper(CommonData, Context);

            if (IsRecordMode)
            {
                // Set mode to none to skip recording during setup
                HttpMockServer.Mode = HttpRecorderMode.None;
                HDInsightManagementHelper.RegisterSubscriptionForResource("Microsoft.HDInsight");
                HDInsightManagementHelper.RegisterSubscriptionForResource("Microsoft.Storage");
                HDInsightManagementHelper.RegisterSubscriptionForResource("Microsoft.DataLakeStore");
                HDInsightManagementHelper.RegisterSubscriptionForResource("Microsoft.ManagedIdentity");
                HDInsightManagementHelper.RegisterSubscriptionForResource("Microsoft.KeyVault");

                this.CreateResources();

                // Set mode back to record
                HttpMockServer.Mode = HttpRecorderMode.Record;

                string mockedSubscriptionId = TestUtilities.GenerateGuid().ToString();
                CommonData.SubscriptionId = HDInsightManagementTestUtilities.GetSubscriptionId();
                this.Context.AddTextReplacementRule(CommonData.SubscriptionId, mockedSubscriptionId);
            }
        }
Example #2
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="commonData"></param>
 /// <param name="context"></param>
 public HDInsightManagementHelper(CommonTestFixture commonData, HDInsightMockContext context)
 {
     resourceManagementClient      = context.GetServiceClient <ResourceManagementClient>();
     storageManagementClient       = context.GetServiceClient <StorageManagementClient>();
     identityManagementClient      = context.GetServiceClient <ManagedServiceIdentityClient>();
     authorizationManagementClient = context.GetServiceClient <AuthorizationManagementClient>();
     keyVaultManagementClient      = context.GetServiceClient <KeyVaultManagementClient>();
     keyVaultClient  = GetKeyVaultClient();
     this.commonData = commonData;
 }
Example #3
0
        /// <summary>
        /// Return a new UndoContext
        /// </summary>
        /// <returns></returns>
        public new static HDInsightMockContext Start(
            Type typeName,
            [System.Runtime.CompilerServices.CallerMemberName]
            string methodName = "testframework_failed")
        {
            var context = new HDInsightMockContext
            {
                innerContext = MockContext.Start(typeName, methodName)
            };

            return(context);
        }