Ejemplo n.º 1
0
        public async Task Handle_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            RemoveGarmentScrapClassificationCommandHandler unitUnderTest = CreateRemoveGarmentScrapClassificationCommandHandler();
            CancellationToken cancellationToken = CancellationToken.None;

            Guid identity = Guid.NewGuid();

            RemoveGarmentScrapClassificationCommand removeGarmentAvalComponentCommand = new RemoveGarmentScrapClassificationCommand(identity);

            _mockGarmentScrapClassificationRepository
            .Setup(s => s.Query)
            .Returns(new List <GarmentScrapClassificationReadModel>
            {
                new GarmentScrapClassification(identity, "code", "name", "description").GetReadModel()
            }.AsQueryable());

            _mockGarmentScrapClassificationRepository
            .Setup(s => s.Update(It.IsAny <GarmentScrapClassification>()))
            .Returns(Task.FromResult(It.IsAny <GarmentScrapClassification>()));

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

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

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

            VerifyUser();

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

            return(Ok(data.Identity));
        }