public async Task Handle_StateUnderTest_ExpectedBehavior() { // Arrange PlaceGarmentScrapSourceCommandHandler unitUnderTest = CreatePlaceGarmentScrapSourceCommandHandler(); CancellationToken cancellationToken = CancellationToken.None; Guid guid = Guid.NewGuid(); PlaceGarmentScrapSourceCommand placeGarmentScrapSourceCommand = new PlaceGarmentScrapSourceCommand() { Code = "code", Name = "name", Description = "desc" }; _mockGarmentScrapSourceRepository .Setup(s => s.Update(It.IsAny <GarmentScrapSource>())) .Returns(Task.FromResult(It.IsAny <GarmentScrapSource>())); _MockStorage .Setup(x => x.Save()) .Verifiable(); // Act var result = await unitUnderTest.Handle(placeGarmentScrapSourceCommand, cancellationToken); // Assert result.Should().NotBeNull(); }
public async Task <IActionResult> Post([FromBody] PlaceGarmentScrapSourceCommand command) { VerifyUser(); var data = await Mediator.Send(command); return(Ok(data.Identity)); }
public void Place_ShouldNotHaveError() { // Arrange Guid id = Guid.NewGuid(); var unitUnderTest = new PlaceGarmentScrapSourceCommand() { Code = "Code", Name = "Name", Description = "Description" }; _mockGarmentScrapSourceRepository.Setup(s => s.Find(It.IsAny <Expression <Func <GarmentScrapSourceReadModel, bool> > >())).Returns(new List <GarmentScrapSource>() { }); var validator = GetValidationRules(); var result = validator.TestValidate(unitUnderTest); // Assert result.ShouldNotHaveError(); }