示例#1
0
        /// <summary>
        /// Return a new UndoContext
        /// </summary>
        /// <returns></returns>
        public new static SynapseMockContext Start(
            Type typeName,
            [System.Runtime.CompilerServices.CallerMemberName]
            string methodName = "testframework_failed")
        {
            var context = new SynapseMockContext
            {
                innerContext = MockContext.Start(typeName, methodName)
            };

            return(context);
        }
        internal virtual void TestInitialize([System.Runtime.CompilerServices.CallerMemberName] string methodName = "testframework_failed")
        {
            Context                 = SynapseMockContext.Start(this.GetType(), methodName);
            CommonData              = new CommonTestFixture();
            SynapseClient           = Context.GetServiceClient <SynapseManagementClient>();
            SynapseManagementHelper = new SynapseManagementHelper(CommonData, Context);

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

                //set mode back to record
                HttpMockServer.Mode = HttpRecorderMode.Record;
                string mockedSubscriptionId = TestUtilities.GenerateGuid().ToString();
                CommonData.SubscriptionId = SynapseManagementTestUtilities.GetSubscriptionId();
                this.Context.AddTextReplacementRule(CommonData.SubscriptionId, mockedSubscriptionId);
            }
        }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="commonData"></param>
 /// <param name="context"></param>
 public SynapseManagementHelper(CommonTestFixture commonData, SynapseMockContext context)
 {
     resourceManagementClient = context.GetServiceClient <ResourceManagementClient>();
     storageManagementClient  = context.GetServiceClient <StorageManagementClient>();
     this.commonData          = commonData;
 }