public async Task <IActionResult> Put(string id, [FromBody] UpdateGarmentScrapDestinationCommand command) { Guid guid = Guid.Parse(id); command.SetIdentity(guid); VerifyUser(); var order = await Mediator.Send(command); return(Ok(order.Identity)); }
public void Place_ShouldNotHaveError() { // Arrange Guid id = Guid.NewGuid(); var unitUnderTest = new UpdateGarmentScrapDestinationCommand() { Code = "Code", Name = "Name", Description = "Description" }; _mockGarmentScrapDestinationRepository.Setup(s => s.Find(It.IsAny <Expression <Func <GarmentScrapDestinationReadModel, bool> > >())).Returns(new List <GarmentScrapDestination>() { }); var validator = GetValidationRules(); var result = validator.TestValidate(unitUnderTest); // Assert result.ShouldNotHaveError(); }
public async Task Handle_StateUnderTest_ExpectedBehavior() { // Arrange Guid identity = Guid.NewGuid(); UpdateGarmentScrapDestinationCommandHandler unitUnderTest = CreateUpdateGarmentScrapDestinationCommandHandler(); CancellationToken cancellationToken = CancellationToken.None; RemoveGarmentScrapDestinationCommand removeGarmentAvalComponentCommand = new RemoveGarmentScrapDestinationCommand(identity); _mockGarmentScrapDestinationRepository .Setup(s => s.Query) .Returns(new List <GarmentScrapDestinationReadModel> { new GarmentScrapDestination(identity, "code", "name", "description").GetReadModel() }.AsQueryable()); _mockGarmentScrapDestinationRepository .Setup(s => s.Update(It.IsAny <GarmentScrapDestination>())) .Returns(Task.FromResult(It.IsAny <GarmentScrapDestination>())); UpdateGarmentScrapDestinationCommand updateGarmentScrapDestinationCommand = new UpdateGarmentScrapDestinationCommand() { Code = "codes", Name = "names", Description = "desss" }; updateGarmentScrapDestinationCommand.SetIdentity(identity); _MockStorage .Setup(x => x.Save()) .Verifiable(); // Act var result = await unitUnderTest.Handle(updateGarmentScrapDestinationCommand, cancellationToken); // Assert result.Should().NotBeNull(); }