/// <summary> /// Initializes a new instance of the <see cref="TestBase" /> class. /// </summary> static TestBase() { IPartnerCredentials credentials = new TestPartnerCredentials(); PartnerSession.Instance.ClientFactory = new MockClientFactory(httpMockHandler, credentials); Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory; PartnerSession.Instance.AuthenticationFactory = new MockAuthenticationFactory(); AzureAccount account = new AzureAccount { Id = "*****@*****.**", Type = AccountType.User }; account.Properties[AzureAccountPropertyType.Tenant] = "0e47c304-9333-4e49-84de-9cb7868b63bc"; account.Properties[AzureAccountPropertyType.UserIdentifier] = "cc2f43c3-92c6-4263-8a1c-e214f5b666fd"; PartnerSession.Instance.Context = new PartnerContext { Account = account, ApplicationId = "427fa6c7-fcf5-473e-8b28-c6d07b842c9e", CountryCode = "US", Environment = EnvironmentName.GlobalCloud, Locale = "en-US", }; }
/// <summary> /// Use the partner operations to perform the test. /// </summary> /// <param name="test">Encapsulates a test to execute.</param> /// <param name="identity">Identity of the test being executed.</param> /// <returns> /// An instance of the <see cref="Task" /> class that represents the asynchronous operation. /// </returns> public async Task UsePartnerForAsync(Func <IPartner, Task> test, [CallerMemberName] string identity = null) { IPartnerCredentials credentials = new TestPartnerCredentials(); await test(TestPartnerService.CreatePartnerOperations(credentials, httpMockHandler)); if (httpMockHandler.Mode == HttpMockHandlerMode.Record) { httpMockHandler.Flush(identity); } }