public void TestGoodService_GetAll_ShouldReturnAllGoods() { // Arrange var goodResult = new List <GoodViewModel> { new GoodViewModel { Id = 1, Name = "Bread Borodinskiy", Amount = 80, BarCode = 54329876 }, new GoodViewModel { Id = 4, Name = "Ice-cream Gosha 80 gr", Amount = 120, BarCode = 99990000 }, new GoodViewModel { Id = 5, Name = "Cigarettes Monte Carlo", Amount = 30, BarCode = 92926741 }, new GoodViewModel { Id = 8, Name = "Chocolate Alpen Gold", Amount = 120, BarCode = 33445522 } }; GoodService ps = new GoodService(new FakeContext()); // Act var result = ps.GetAll(); // Assert Assert.AreEqual(true, (goodResult[0].Id == result[0].Id) && (goodResult[1].Name == result[1].Name) && (goodResult[2].Amount == result[2].Amount) && (goodResult[3].BarCode == result[3].BarCode)); }
public MainViewModel(GoodService goodService, CategoryService categoryService, ManufacturerService manufacturerService) { this.goodService = goodService; this.categoryService = categoryService; this.manufacturerService = manufacturerService; Categories = new ObservableCollection <CategoryDTO>(categoryService.GetAll()); Goods = new ObservableCollection <GoodDTO>(goodService.GetAll()); Manufacturers = new ObservableCollection <ManufacturerDTO>(manufacturerService.GetAll()); InitCommands(); }
public ActionResult Trucks() { var goods = gs.GetAll().OrderByDescending(t => t.CreateTime).ThenByDescending(t => t.UpdateTime).Take(8).ToList(); return(View(goods)); }