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 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(); }