public async Task WhenIUseTheOperationsControlClientToCreateAnOperation(Table table) { string idName = table.Rows[0]["IdName"]; Guid id = this.ScenarioContext.Get <Guid>(idName); string resourceLocation = table.Rows[0]["ResourceLocation"]; long expireAfter = long.Parse(table.Rows[0]["ExpireAfter"]); string body = table.Rows[0]["Body"]; IServiceProvider serviceProvider = ContainerBindings.GetServiceProvider(this.FeatureContext); IMarainOperationsControl client = serviceProvider.GetRequiredService <IMarainOperationsControl>(); var transientTenantManager = TransientTenantManager.GetInstance(this.FeatureContext); await Exceptions.ExecuteAndStoreExceptionAsync( this.ScenarioContext, async() => { CreateOperationHeaders result = await client.CreateOperationAsync( transientTenantManager.PrimaryTransientClient.Id, id, resourceLocation, expireAfter, body).ConfigureAwait(false); this.ScenarioContext.Set(result); }).ConfigureAwait(false); }
public async Task WhenIUseTheOperationsControlClientToCreateAnOperationWithTheIdCalled(string operationIdName) { Guid operationId = this.ScenarioContext.Get <Guid>(operationIdName); IServiceProvider serviceProvider = ContainerBindings.GetServiceProvider(this.FeatureContext); IMarainOperationsControl client = serviceProvider.GetRequiredService <IMarainOperationsControl>(); var transientTenantManager = TransientTenantManager.GetInstance(this.FeatureContext); await Exceptions.ExecuteAndStoreExceptionAsync( this.ScenarioContext, async() => { CreateOperationHeaders result = await client.CreateOperationAsync( transientTenantManager.PrimaryTransientClient.Id, operationId).ConfigureAwait(false); this.ScenarioContext.Set(result); }).ConfigureAwait(false); }
/// <summary> /// Create a new operation, which will be in the "Not Started" state /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// Id of the Tenant. /// </param> /// <param name='operationId'> /// Id of the Operation. /// </param> /// <param name='resourceLocation'> /// Optional URI based location of the result of the Operation. /// </param> /// <param name='expireAfter'> /// Optional number of seconds for which to retain data about this operation /// after its last state change /// </param> /// <param name='body'> /// </param> public static CreateOperationHeaders CreateOperation(this IMarainOperationsControl operations, string tenantId, System.Guid operationId, string resourceLocation = default(string), long?expireAfter = default(long?), string body = default(string)) { return(operations.CreateOperationAsync(tenantId, operationId, resourceLocation, expireAfter, body).GetAwaiter().GetResult()); }