GetById() public method

Получение информации о курсе по его идентификатору
public GetById ( int Id ) : ProductViewModel
Id int
return ProductViewModel
Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 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);
 }