public void Test_Place_Order()
        {
            TblFoodOrder OrderedFoodDetails = new TblFoodOrder()
            {
                TblRestaurantId     = 10,
                TblCustomerId       = 10,
                DeliveryAddress     = "test address",
                TblFoodOrderMapping = new List <TblFoodOrderMapping>()
                {
                    new TblFoodOrderMapping()
                    {
                        TblMenuId = 1,
                        Price     = 10000
                    }
                }
            };

            var options = new DbContextOptionsBuilder <OrderManagementContext>()
                          .UseInMemoryDatabase(databaseName: "OrderManagement")
                          .Options;

            PlaceOrderDbAccess placeOrderDbAccess = new PlaceOrderDbAccess(new OrderManagementContext(options));
            int OrderId = placeOrderDbAccess.PlaceOrder(OrderedFoodDetails);

            Assert.Greater(OrderId, 0);
        }
Ejemplo n.º 2
0
 public int PlaceOrder(TblFoodOrder OrderedFoodDetails)
 {
     try
     {
         _context.TblFoodOrder.Add(OrderedFoodDetails);
         _context.SaveChanges();
         return(OrderedFoodDetails.Id);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 3
0
 public int PlaceOrder(TblFoodOrder OrderedFoodDetails)
 {
     _context.TblFoodOrder.Add(OrderedFoodDetails);
     _context.SaveChanges();
     return(OrderedFoodDetails.Id);
 }