public async Task CreateProductVerify()
        {
            // Arrange
            var newProduct = new MS.Products.Application.Product
            {
                id = 1
            };

            _productRepositoryMock.Setup(m => m.Create(newProduct)).ReturnsAsync(1);

            //Act
            var actual = await _productRepositoryMock.Object.Create(newProduct);

            //Asert

            actual.Should().BeGreaterThan(0);
        }
        public async Task UpdateStateProductVerify()
        {
            // Arrange
            var product = new MS.Products.Application.Product
            {
                id        = 1,
                is_active = false
            };

            _productRepositoryMock.Setup(m => m.Update_State(product)).ReturnsAsync(true);

            //Act
            var actual = await _productRepositoryMock.Object.Update_State(product);

            //Asert

            actual.Should().Be(true);
        }
Exemple #3
0
        public async Task UpdateStateProductVerifyIsCalled()
        {
            // Arrange
            var product = new MS.Products.Application.Product
            {
                id    = 1,
                model = "Producto Nuevo"
            };

            _IDateServiceMock.Setup(m => m.GetDate()).Returns(DateTime.Now);
            _IProductRepositoryMock.Setup(m => m.Update_State(product)).ReturnsAsync(true);

            // Act

            var actual = await _sut.UpdateState(product);

            // Assert
            ((ObjectResult)actual).StatusCode.Should().Be((int)HttpStatusCode.OK);
        }
Exemple #4
0
        public async Task GetProductVerifyIsCalled()
        {
            // Arrange
            var product = new MS.Products.Application.Product
            {
                id    = 1,
                model = "Producto Nuevo"
            };

            var resultQuery = new ProductViewModel
            {
                id = 1
            };

            _IProductQueryMock.Setup(m => m.GetById(product.id)).ReturnsAsync(resultQuery);

            // Act

            var actual = await _sut.Get(product.id);

            // Assert
            ((ObjectResult)actual).StatusCode.Should().Be((int)HttpStatusCode.OK);
        }