Exemplo n.º 1
0
 public void TestGoodService_GetGood_ShouldReturnGood()
 {
     // Arrange
     var goodResult = new GoodViewModel { Id = 1, Name = "Bread Borodinskiy", Amount = 80, BarCode = 54329876 };
     GoodService ps = new GoodService(new FakeContext());
     // Act
     var result = ps.GetGood(1);
     // Assert
     Assert.AreEqual(true, (goodResult.Id == result.Id) 
                           && (goodResult.Amount == result.Amount) 
                           && (goodResult.Name == result.Name) 
                           && (goodResult.BarCode == result.BarCode));
 }
Exemplo n.º 2
0
 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));
 }