public OrderServicingDateWrapper(Order order, DateTime servicingDate)
        {
            if (order == null)
                throw new ArgumentNullException("order");

            if(servicingDate.CompareTo(DateTime.Now) < 0)
                throw new ArgumentException("The specified servicing date is in the past", "servicingDate");

            Order = new Order(order);
            ServicingDate = servicingDate;
        }
        public void ClientAddOrderTest()
        {
            ClientLogInTest();

            if (category1 == null)
                AddNewCategoryTest();
            if (table1 == null)
                AddNewTableTest();
            if (menuItem1 == null)
                AddNewMenuItemTest();

            var menuItems = new List<Tuple<int, int>>
            {
                new Tuple<int, int>(menuItem1.Id, menuItemQuantity1),
                new Tuple<int, int>(menuItem2.Id, menuItemQuantity2),
                new Tuple<int, int>(menuItem3.Id, menuItemQuantity3)
            };

            order1 = clientDataAccess.AddOrder(clientContext1.Id, table1.Id, menuItems);
            Assert.IsNotNull(order1);
            Assert.AreNotEqual(order1.Id, 0);
            Assert.AreEqual(order1.Client.Id, clientContext1.Id);
            //Assert.IsNotNull(order1.Waiter);
            //Assert.AreEqual(order1.Waiter.Id, waiterContext1.Id);
            Assert.AreEqual(order1.State, OrderState.Placed);
            Assert.IsNotNull(order1.Table);
            Assert.AreEqual(order1.Table.Id, table1.Id);
            Assert.IsNotNull(order1.MenuItems);
            Assert.AreEqual(order1.MenuItems.Count, 3);
            Assert.AreEqual(order1.MenuItems.ElementAt(0).MenuItem.Id, menuItem1.Id);
            Assert.AreEqual(order1.MenuItems.ElementAt(0).Quantity, menuItemQuantity1);
            Assert.AreEqual(order1.MenuItems.ElementAt(1).MenuItem.Id, menuItem2.Id);
            Assert.AreEqual(order1.MenuItems.ElementAt(1).Quantity, menuItemQuantity2);
            Assert.AreEqual(order1.MenuItems.ElementAt(2).MenuItem.Id, menuItem3.Id);
            Assert.AreEqual(order1.MenuItems.ElementAt(2).Quantity, menuItemQuantity3);
            Assert.IsTrue(order1.PlacingDate < DateTime.Now);
            Assert.AreEqual(order1.ClosingDate, DateTime.MaxValue);

            ClientLogOutTest();
        }
        public void TestCleanup()
        {
            if (order1 != null)
                dataWipe.WipeOrder(order1.Id);

            if (managerContext1 != null)
                dataWipe.WipeUser(managerContext1.Id);

            if (clientContext1 != null)
                dataWipe.WipeUser(clientContext1.Id);

            if (waiterContext1 != null)
                dataWipe.WipeUser(waiterContext1.Id);

            if (waiterContext2 != null)
                dataWipe.WipeUser(waiterContext2.Id);

            if (menuItem1 != null)
                dataWipe.WipeMenuItem(menuItem1.Id);

            if (menuItem2 != null)
                dataWipe.WipeMenuItem(menuItem2.Id);

            if (menuItem3 != null)
                dataWipe.WipeMenuItem(menuItem3.Id);

            if (category1 != null)
                dataWipe.WipeMenuItemCategory(category1.Id);

            if (table1 != null)
                dataWipe.WipeTable(table1.Id);

            order1 = null;
            managerContext1 = null;
            waiterContext1 = null;
            waiterContext2 = null;
            clientContext1 = null;
            category1 = null;
            menuItem1 = null;
            menuItem2 = null;
            menuItem3 = null;
            table1 = null;
        }
        /// <summary>
        /// Konstruktor kopiujący
        /// </summary>
        /// <param name="orderToCopy">Zamówienie do skopiowania</param>
        public Order(Order orderToCopy)
            : base(orderToCopy)
        {
            if(orderToCopy == null)
                throw new ArgumentNullException("orderToCopy");

            Client = new UserContext(orderToCopy.Client);

            if (orderToCopy.Waiter != null)
                Waiter = new UserContext(orderToCopy.Waiter);

            if (orderToCopy.Table != null)
                Table = new Table(orderToCopy.Table);

            if (orderToCopy.MenuItems != null)
            {
                MenuItems = new List<MenuItemQuantity>();
                foreach (var menuItemQuant in orderToCopy.MenuItems)
                    MenuItems.Add(new MenuItemQuantity(menuItemQuant));
            }

            State = orderToCopy.State;
            PlacingDate = orderToCopy.PlacingDate;
            ClosingDate = orderToCopy.ClosingDate;
        }