public async Task <IActionResult> Put(string id, [FromBody] UpdateGarmentScrapSourceCommand 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(); UpdateGarmentScrapSourceCommandHandler unitUnderTest = CreateUpdateGarmentScrapSourceCommandHandler(); CancellationToken cancellationToken = CancellationToken.None; RemoveGarmentScrapSourceCommand removeGarmentAvalComponentCommand = new RemoveGarmentScrapSourceCommand(identity); _mockGarmentScrapSourceRepository .Setup(s => s.Query) .Returns(new List <GarmentScrapSourceReadModel> { new GarmentScrapSource(identity, "code", "name", "description").GetReadModel() }.AsQueryable()); _mockGarmentScrapSourceRepository .Setup(s => s.Update(It.IsAny <GarmentScrapSource>())) .Returns(Task.FromResult(It.IsAny <GarmentScrapSource>())); UpdateGarmentScrapSourceCommand updateGarmentScrapSourceCommand = new UpdateGarmentScrapSourceCommand() { Code = "codes", Name = "names", Description = "desss" }; updateGarmentScrapSourceCommand.SetIdentity(identity); _MockStorage .Setup(x => x.Save()) .Verifiable(); // Act var result = await unitUnderTest.Handle(updateGarmentScrapSourceCommand, cancellationToken); // Assert result.Should().NotBeNull(); }