public async Task Handle_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            PlaceGarmentScrapDestinationCommandHandler unitUnderTest = CreatePlaceGarmentScrapDestinationCommandHandler();
            CancellationToken cancellationToken = CancellationToken.None;

            Guid guid = Guid.NewGuid();

            PlaceGarmentScrapDestinationCommand placeGarmentScrapDestinationCommand = new PlaceGarmentScrapDestinationCommand()
            {
                Code        = "code",
                Name        = "name",
                Description = "desc"
            };

            _mockGarmentScrapDestinationRepository
            .Setup(s => s.Update(It.IsAny <GarmentScrapDestination>()))
            .Returns(Task.FromResult(It.IsAny <GarmentScrapDestination>()));

            _MockStorage
            .Setup(x => x.Save())
            .Verifiable();

            // Act
            var result = await unitUnderTest.Handle(placeGarmentScrapDestinationCommand, cancellationToken);

            // Assert
            result.Should().NotBeNull();
        }
Esempio n. 2
0
        public async Task <IActionResult> Post([FromBody] PlaceGarmentScrapDestinationCommand command)
        {
            VerifyUser();

            var data = await Mediator.Send(command);

            return(Ok(data.Identity));
        }
Esempio n. 3
0
        public void Place_ShouldNotHaveError()
        {
            // Arrange
            Guid id            = Guid.NewGuid();
            var  unitUnderTest = new PlaceGarmentScrapDestinationCommand()
            {
                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();
        }