public async Task GetProductItemById_GetProductItemById_ShoudReturnWithSuccess() { //Arrange var mocker = new AutoMocker(); mocker.GetMock <IRepositoryProductItem>() .Setup(r => r.GetProductItemByIdAsync(It.IsAny <Guid>())) .Returns(Task.FromResult(_productItemTestFixture.GenerateValidProduct())); var serviceProduct = mocker.CreateInstance <ServiceProduct>(); //Act var productItem = await serviceProduct.GetProductItemByIdAsync(Guid.NewGuid()); //Assert productItem.Should().NotBeNull(); mocker.GetMock <IRepositoryProductItem>().Verify(r => r.GetProductItemByIdAsync(It.IsAny <Guid>()), Times.Once); }
public void ProductItem_NewProduct_ShouldBeValid() { //Arrange var productItem = _productItemTestFixture.GenerateValidProduct(); //Act var result = productItem.ValidateProductItem(); //Assert Assert.True(result.IsValid); }