private ScenarioExecutionContext CreateCurrentContext() { var executionContext = new ScenarioExecutionContext(); executionContext.Get <CurrentScenarioProperty>().Scenario = this; return(executionContext); }
protected override async Task ExecuteAsync(ScenarioExecutionContext context) { var roleAppService = context.ServiceProvider.GetRequiredService <IIdentityRoleAppService>(); var createdRole = await roleAppService.CreateAsync(new IdentityRoleCreateDto { Name = Guid.NewGuid().ToString("N") }); context.Properties["CreatedRoleId"] = createdRole.Id; }
protected override async Task ExecuteAsync(ScenarioExecutionContext context) { var userAppService = context.ServiceProvider.GetRequiredService <IIdentityUserAppService>(); var user = (IdentityUserDto)context.Properties["CreatedUser"]; await userAppService.DeleteAsync(user.Id); }
protected override async Task ExecuteAsync(ScenarioExecutionContext context) { var userAppService = context.ServiceProvider.GetRequiredService <IIdentityUserAppService>(); var createdUser = await userAppService.CreateAsync( new IdentityUserCreateDto { Name = Guid.NewGuid().ToString("N"), Surname = Guid.NewGuid().ToString("N"), Email = Guid.NewGuid().ToString("N") + "@abp.io", Password = "******", UserName = Guid.NewGuid().ToString("N") } ); context.Properties["CreatedUser"] = createdUser; }
protected override async Task ExecuteAsync(ScenarioExecutionContext context) { var userAppService = context.ServiceProvider.GetRequiredService <IIdentityUserAppService>(); var user = (IdentityUserDto)context.Properties["CreatedUser"]; await userAppService.UpdateAsync( user.Id, new IdentityUserUpdateDto { Name = Guid.NewGuid().ToString("N"), Surname = Guid.NewGuid().ToString("N"), Email = user.Email, UserName = user.UserName, ConcurrencyStamp = user.ConcurrencyStamp } ); }
public async Task RunAsync(ScenarioExecutionContext context) { await BeforeExecuteAsync(context); var stopwatch = Stopwatch.StartNew(); try { await ExecuteAsync(context); SuccessCount++; LastExecutionDuration = stopwatch.Elapsed.TotalMilliseconds; TotalExecutionDuration += LastExecutionDuration; if (MinExecutionDuration > LastExecutionDuration) { MinExecutionDuration = LastExecutionDuration; } if (MaxExecutionDuration < LastExecutionDuration) { MaxExecutionDuration = LastExecutionDuration; } } catch (Exception ex) { FailCount++; context .ServiceProvider .GetService <ILogger <ScenarioStep> >() .LogException(ex); } finally { stopwatch.Stop(); ExecutionCount++; } await AfterExecuteAsync(context); }
protected override Task ExecuteAsync(ScenarioExecutionContext context) { return(Task.Delay(Duration)); }
protected Scenario(IServiceProvider serviceProvider) { ExecutionContext = new ScenarioExecutionContext(serviceProvider); Steps = new List <ScenarioStep>(); }
protected virtual Task AfterExecuteAsync(ScenarioExecutionContext context) { return(Task.CompletedTask); }
protected abstract Task ExecuteAsync(ScenarioExecutionContext context);
protected override async Task ExecuteAsync(ScenarioExecutionContext context) { var roleAppService = context.ServiceProvider.GetRequiredService <IIdentityRoleAppService>(); await roleAppService.GetListAsync(new GetIdentityRolesInput { MaxResultCount = 10 }); }
protected override async Task ExecuteAsync(ScenarioExecutionContext context) { var roleAppService = context.ServiceProvider.GetRequiredService <IIdentityRoleAppService>(); await roleAppService.DeleteAsync((Guid)context.Properties["CreatedRoleId"]); }