Exemple #1
0
        internal virtual void TestInitialize([System.Runtime.CompilerServices.CallerMemberName] string methodName = "testframework_failed")
        {
            Context = QuantumMockContext.Start(this.GetType(), methodName);

            UseAzLoginCredentialsIfNeeded();

            CommonData              = new CommonTestFixture();
            QuantumClient           = Context.GetServiceClient <QuantumManagementClient>();
            QuantumManagementHelper = new QuantumManagementHelper(CommonData, Context);

            if (IsRecordMode)
            {
                //set mode to none to skip recoding during setup
                HttpMockServer.Mode = HttpRecorderMode.None;
                QuantumManagementHelper.RegisterSubscriptionForResource("Microsoft.Quantum");
                QuantumManagementHelper.RegisterSubscriptionForResource("Microsoft.Storage");
                this.CreateResources();

                //set mode back to record
                HttpMockServer.Mode = HttpRecorderMode.Record;
                string mockedSubscriptionId = TestUtilities.GenerateGuid().ToString();
                CommonData.SubscriptionId = QuantumManagementTestUtilities.GetSubscriptionId();
                this.Context.AddTextReplacementRule(CommonData.SubscriptionId, mockedSubscriptionId);
            }
        }
Exemple #2
0
        /// <summary>
        /// Return a new UndoContext
        /// </summary>
        /// <returns></returns>
        public new static QuantumMockContext Start(
            Type typeName,
            [System.Runtime.CompilerServices.CallerMemberName]
            string methodName = "testframework_failed")
        {
            var context = new QuantumMockContext
            {
                innerContext = MockContext.Start(typeName, methodName)
            };

            return(context);
        }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="commonData"></param>
 /// <param name="context"></param>
 public QuantumManagementHelper(CommonTestFixture commonData, QuantumMockContext context)
 {
     resourceManagementClient = context.GetServiceClient <ResourceManagementClient>();
     storageManagementClient  = context.GetServiceClient <StorageManagementClient>();
     this.commonData          = commonData;
 }