Ejemplo n.º 1
0
        public async Task ShouldUpdateStepsIntoScenario()
        {
            var createScenarioCommand = new CreateScenarioCommand("s1", createProjectDto.Id);
            var createScenarioDto     = await SendAsync(createScenarioCommand);

            var updateScenarioCommand = new UpdateStepsToScenarioCommand(createScenarioDto.Id, createProjectDto.Id, new List <UpdateStepsToScenarioCommand.StepDto>
            {
                new UpdateStepsToScenarioCommand.StepDto(1, "step 1"),
                new UpdateStepsToScenarioCommand.StepDto(2, "step 2"),
                new UpdateStepsToScenarioCommand.StepDto(3, "step 3"),
            });

            await SendAsync(updateScenarioCommand);

            var scenarioEntity = await ExecuteDbContextAsync(db => db.Scenarios
                                                             .Include(s => s.StepsList)
                                                             .SingleOrDefaultAsync(p => p.Id.Equals(createScenarioDto.Id))
                                                             );

            scenarioEntity.ShouldNotBeNull();
            scenarioEntity.StepsList.Count.ShouldBe(3);

            var deleteScenarioCommand = new DeleteScenarioCommand(createScenarioDto.Id, createProjectDto.Id);

            await SendAsync(deleteScenarioCommand);

            scenarioEntity = await ExecuteDbContextAsync(db => db.Scenarios
                                                         .SingleOrDefaultAsync(p => p.Id.Equals(createScenarioDto.Id))
                                                         );

            scenarioEntity.ShouldBeNull();
        }
Ejemplo n.º 2
0
        public async Task ShouldUpdateScenario()
        {
            var createScenarioCommand = new CreateScenarioCommand("s1", createProjectDto.Id);
            var createScenarioDto     = await SendAsync(createScenarioCommand);

            var updateScenarioCommand = new UpdateScenarioCommand(createScenarioDto.Id, createProjectDto.Id, "description 1");

            await SendAsync(updateScenarioCommand);

            var scenarioEntity = await ExecuteDbContextAsync(db => db.Scenarios
                                                             .SingleOrDefaultAsync(p => p.Id.Equals(createScenarioDto.Id))
                                                             );

            scenarioEntity.ShouldNotBeNull();
            scenarioEntity.Description.ShouldBe("description 1");

            var deleteScenarioCommand = new DeleteScenarioCommand(createScenarioDto.Id, createProjectDto.Id);

            await SendAsync(deleteScenarioCommand);

            scenarioEntity = await ExecuteDbContextAsync(db => db.Scenarios
                                                         .SingleOrDefaultAsync(p => p.Id.Equals(createScenarioDto.Id))
                                                         );

            scenarioEntity.ShouldBeNull();
        }
Ejemplo n.º 3
0
        public async Task ShouldGetScenarioWithSteps()
        {
            var createScenarioCommand = new CreateScenarioCommand("s1", createProjectDto.Id);
            var createScenarioDto     = await SendAsync(createScenarioCommand);

            var updateStepsToScenarioCommand = new UpdateStepsToScenarioCommand(createScenarioDto.Id, createProjectDto.Id, new List <UpdateStepsToScenarioCommand.StepDto>
            {
                new UpdateStepsToScenarioCommand.StepDto(1, "step 1"),
                new UpdateStepsToScenarioCommand.StepDto(2, "step 2"),
                new UpdateStepsToScenarioCommand.StepDto(3, "step 3"),
            });

            await SendAsync(updateStepsToScenarioCommand);

            var getScenarioCommand = new GetScenarioQuery(createScenarioDto.Id, createProjectDto.Id, true);
            var getScenarioDto     = await SendAsync(getScenarioCommand);

            getScenarioDto.ShouldNotBeNull();
            getScenarioDto.StepList.ShouldNotBeNull();
            getScenarioDto.StepList.Count.ShouldBe(3);
            getScenarioDto.Description.ShouldBe("s1");
            getScenarioDto.ProjectId.ShouldBe(createProjectDto.Id);

            var deleteScenarioCommand = new DeleteScenarioCommand(createScenarioDto.Id, createProjectDto.Id);

            await SendAsync(deleteScenarioCommand);
        }
Ejemplo n.º 4
0
        public override async Task DisposeAsync()
        {
            var deleteScenarioCommand = new DeleteScenarioCommand(createScenarioDto.Id, createProjectDto.Id);

            await SendAsync(deleteScenarioCommand);

            var deleteFeatureCommand = new DeleteFeatureCommand(createFeatureDto.Id, createProjectDto.Id);

            await SendAsync(deleteFeatureCommand);

            var deleteProjectCommand = new DeleteProjectCommand(createProjectDto.Id);

            await SendAsync(deleteProjectCommand);

            await base.DisposeAsync();
        }
Ejemplo n.º 5
0
        public async Task ShouldGetScenarioList()
        {
            var createScenarioCommand = new CreateScenarioCommand("s1", createProjectDto.Id);
            var createScenarioDto     = await SendAsync(createScenarioCommand);

            var getScenarioListCommand = new GetScenarioListQuery(createProjectDto.Id, false, false);
            var getScenarioListDto     = await SendAsync(getScenarioListCommand);

            getScenarioListDto.ShouldNotBeNull();
            getScenarioListDto.Data.ShouldNotBeNull();
            getScenarioListDto.Count.ShouldNotBe(0);
            getScenarioListDto.Data.ShouldBeOfType <List <GetScenarioDto> >();

            var deleteScenarioCommand = new DeleteScenarioCommand(createScenarioDto.Id, createProjectDto.Id);

            await SendAsync(deleteScenarioCommand);
        }
Ejemplo n.º 6
0
        public async Task ShouldGetScenario()
        {
            var createScenarioCommand = new CreateScenarioCommand("s1", createProjectDto.Id);
            var createScenarioDto     = await SendAsync(createScenarioCommand);

            var getScenarioCommand = new GetScenarioQuery(createScenarioDto.Id, createProjectDto.Id, false);
            var getScenarioDto     = await SendAsync(getScenarioCommand);

            getScenarioDto.ShouldNotBeNull();
            getScenarioDto.StepList.Count.ShouldBe(0);
            getScenarioDto.Description.ShouldBe("s1");
            getScenarioDto.ProjectId.ShouldBe(createProjectDto.Id);

            var deleteScenarioCommand = new DeleteScenarioCommand(createScenarioDto.Id, createProjectDto.Id);

            await SendAsync(deleteScenarioCommand);
        }