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

            Guid identity = Guid.NewGuid();

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

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

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

            // Assert
            result.Should().NotBeNull();
        }
Esempio n. 2
0
        public async Task <IActionResult> Delete(string id)
        {
            Guid guid = Guid.Parse(id);

            VerifyUser();

            RemoveGarmentScrapDestinationCommand command = new RemoveGarmentScrapDestinationCommand(guid);
            var data = await Mediator.Send(command);

            return(Ok(data.Identity));
        }