Пример #1
0
 public RestaurantsController(IRestaurantContext restaurantContext)
 {
     _restaurantContext = restaurantContext;
 }
Пример #2
0
 public RestaurantRepository(IRestaurantContext context)
 {
     Context = context;
 }
Пример #3
0
 public RestaurantController(IConfiguration config)
 {
     context = new RestaurantMSSQLContext(config.GetConnectionString("DefaultConnection"));
     rep     = new RestaurantRepository(context);
 }
 public RestaurantRepository(IRestaurantContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
        private void VerifyResults(List<string> expectedTableNumber, string expectedOrderStatus, IRestaurantContext context)
        {
            Type type = context.GetType();
            PropertyInfo[] properties = type.GetProperties();
            foreach (PropertyInfo property in properties)
            {
                if (property == null) continue;

                bool isEnumerable = (from i in property.PropertyType.GetInterfaces()
                                     where i == typeof(IEnumerable)
                                     select i
                    ).Any();

                if (!isEnumerable) continue;

                try
                {
                    if (property.Name.Contains("customerOrders"))
                    {
                        int i = 0;
                        foreach (CustomerOrder custOrder in (IEnumerable)property.GetValue(context, null))
                        {
                            string ss = custOrder.StartTime.ToLongTimeString();
                            string tableNumber = custOrder.TableNumber;

                            NUnit.Framework.Assert.AreEqual(expectedTableNumber[i], tableNumber);
                            NUnit.Framework.Assert.AreEqual(expectedOrderStatus, ((OrderStatus)custOrder.Status).ToString());

                            foreach (ItemOrderXRef item in custOrder.Items)
                            {
                                NUnit.Framework.Assert.AreEqual(custOrder.CustomerOrderId, item.CustomerOrderId);
                            }

                            i++;
                        }
                        break;
                    }
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                    if (ex.InnerException != null)
                        error += ex.InnerException.Message;
                    NUnit.Framework.Assert.Fail(error);
                }
            }
        }
 public void Initialize()
 {
     fakeRestaurantContext = new FakeRestaurantContext();
 }
 public void CleanUp()
 {
     fakeRestaurantContext = null;
 }
 public WaiterBL(IRestaurantContext Context)
 {
     this.context = DbContextHelper.GetRestaurantContext(Context);
 }
Пример #9
0
 public RestaurantController()
 {
     context = new RestaurantMSSQLContext();
     rep     = new RestaurantRepository(context);
 }