public void GetByIdTest() { IProductService _productService = new ProductService(new ProductRepository(), new AccountRepository(), new PartnerRepository(), new ProductFilterFactory()); ProductViewModel _productViewModel = GetProductViewModel(); _productService.Add(_productViewModel); Assert.IsNotNull(_productService.GetById(1)); }
public void EditTest() { IProductService _productService = new ProductService(new ProductRepository(), new AccountRepository(), new PartnerRepository(), new ProductFilterFactory()); ProductViewModel _productViewModel = GetProductViewModel(); _productService.Add(_productViewModel); _productViewModel.Description = "otherDescription"; _productService.Edit(_productViewModel); bool actual, expected = true; if(_productService.GetById(1).Description.CompareTo("otherDisctiption") == 0) { actual = true; } else { actual = false; } Assert.AreEqual(expected, actual); }