public async void LocationIndustryShouldThrowNotFoundException()
        {
            var updatedLocationIndustry = new UpdateLocationIndustryCommand {
                LocationId = GConst.InvalidId, IndustryId = GConst.InvalidId, Description = GConst.ValidName
            };

            var status = await Record.ExceptionAsync(async() => await sut.Handle(updatedLocationIndustry, CancellationToken.None));

            Assert.NotNull(status);
            Assert.Equal(string.Format(GConst.NotFoundExceptionMessage, GConst.LocationIndustry, $"{GConst.InvalidId} - {GConst.InvalidId}"), status.Message);
        }
        public async void LocationIndustryShouldUpdateCorrect()
        {
            CommandArrangeHelper.AddLocationIndustry(context, industryId, locationId);

            var updatedLocationIndustrie = new UpdateLocationIndustryCommand {
                LocationId = locationId, IndustryId = industryId, Description = GConst.ValidName
            };

            var status = Task <Unit> .FromResult(await sut.Handle(updatedLocationIndustrie, CancellationToken.None));

            var locationIdResult = context.LocationIndustries.SingleOrDefault(x => x.Description == GConst.ValidName).LocationId;
            var industryIdResult = context.LocationIndustries.SingleOrDefault(x => x.Description == GConst.ValidName).IndustryId;

            Assert.Equal(locationId, locationIdResult);
            Assert.Equal(industryId, industryIdResult);
            Assert.Equal(GConst.SuccessStatus, status.Status.ToString());
            Assert.Equal(GConst.ValidCount, context.LocationIndustries.Count());
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Update([FromForm] UpdateLocationIndustryCommand command)
        {
            await Mediator.Send(command);

            return(NoContent());
        }
Ejemplo n.º 4
0
 public UpdateLocationIndustryCommandValidatorTests()
 {
     this.updateValidator = new UpdateLocationIndustryCommandValidator();
     this.updateCommand   = new UpdateLocationIndustryCommand();
 }