public override async Task DisposeAsync()
        {
            var deleteFeatureCommand = new DeleteFeatureCommand(createFeatureDto.Id, createProjectDto.Id);

            await SendAsync(deleteFeatureCommand);

            var deleteProjectCommand = new DeleteProjectCommand(createProjectDto.Id);

            await SendAsync(deleteProjectCommand);

            await base.DisposeAsync();
        }
Пример #2
0
        public async Task ShouldDeleteFeature()
        {
            var createFeatureCommand = new CreateFeatureCommand("feature1", createProjectDto.Id);
            var createFeatureDto     = await SendAsync(createFeatureCommand);

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

            await SendAsync(deleteFeatureCommand);

            var featureEntity = await ExecuteDbContextAsync(db => db.Features
                                                            .SingleOrDefaultAsync(p => p.Id.Equals(createFeatureDto.Id))
                                                            );

            featureEntity.ShouldBeNull();
        }
Пример #3
0
        public async Task ShouldGetFeatureList()
        {
            var createFeatureCommand = new CreateFeatureCommand("feature1", createProjectDto.Id);
            var createFeatureDto     = await SendAsync(createFeatureCommand);

            var getFeatureListCommand = new GetFeatureListQuery(createProjectDto.Id);
            var getFeatureListDto     = await SendAsync(getFeatureListCommand);

            getFeatureListDto.ShouldNotBeNull();
            getFeatureListDto.Data.ShouldNotBeNull();
            getFeatureListDto.Count.ShouldNotBe(0);
            getFeatureListDto.Data.ShouldBeOfType <List <GetFeatureDto> >();

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

            await SendAsync(deleteFeatureCommand);
        }
Пример #4
0
        public async Task ShouldGetFeature()
        {
            var createFeatureCommand = new CreateFeatureCommand("feature1", createProjectDto.Id);
            var createFeatureDto     = await SendAsync(createFeatureCommand);

            var getFeatureCommand = new GetFeatureQuery(createFeatureDto.Id, createProjectDto.Id);
            var getFeatureDto     = await SendAsync(getFeatureCommand);

            getFeatureDto.ShouldNotBeNull();
            getFeatureDto.Description.ShouldBeNull();
            getFeatureDto.Name.ShouldBe("feature1");
            getFeatureDto.ProjectId.ShouldBe(createProjectDto.Id);

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

            await SendAsync(deleteFeatureCommand);
        }
Пример #5
0
        public async Task <IActionResult> DeleteFeature(long id)
        {
            var dfc = new DeleteFeatureCommand()
            {
                Id = id
            };

            var result = await _cp.ProcessAsync(dfc);

            if (result.Succeeded)
            {
                return(RedirectToAction("ManageFeatures"));
            }
            else
            {
                return(NotFound());
            }
        }
Пример #6
0
        public async Task ShouldUpdateFeature()
        {
            var createFeatureCommand = new CreateFeatureCommand("feature1", createProjectDto.Id);
            var createFeatureDto     = await SendAsync(createFeatureCommand);


            var updateFeatureCommand = new UpdateFeatureInfoCommand(createFeatureDto.Id, createProjectDto.Id, "update feature1", "description");

            await SendAsync(updateFeatureCommand);


            var featureEntity = await ExecuteDbContextAsync(db => db.Features
                                                            .SingleOrDefaultAsync(p => p.Id.Equals(createFeatureDto.Id))
                                                            );

            featureEntity.ShouldNotBeNull();
            featureEntity.Name.ShouldBe("update feature1");
            featureEntity.Description.ShouldBe("description");

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

            await SendAsync(deleteFeatureCommand);
        }