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;
        }
Example #5
0
        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
            }
                );
        }
Example #6
0
    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);
    }
Example #7
0
 protected override Task ExecuteAsync(ScenarioExecutionContext context)
 {
     return(Task.Delay(Duration));
 }
Example #8
0
 protected Scenario(IServiceProvider serviceProvider)
 {
     ExecutionContext = new ScenarioExecutionContext(serviceProvider);
     Steps            = new List <ScenarioStep>();
 }
Example #9
0
 protected virtual Task AfterExecuteAsync(ScenarioExecutionContext context)
 {
     return(Task.CompletedTask);
 }
Example #10
0
 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 });
        }
Example #12
0
        protected override async Task ExecuteAsync(ScenarioExecutionContext context)
        {
            var roleAppService = context.ServiceProvider.GetRequiredService <IIdentityRoleAppService>();

            await roleAppService.DeleteAsync((Guid)context.Properties["CreatedRoleId"]);
        }