示例#1
0
        public void It_returns_the_price_of_milk()
        {
            var           unit = new ShopCatalogue();
            IPurchaseable item = new Milk();

            Assert.That(unit.LookupPrice(item).AsCurrency(), Is.EqualTo(1.15));
        }
示例#2
0
        public void PropertyNameInheritence()
        {
            var m = new Milk(1, 3.25);

            Assert.Equal(1, m.C);
            Assert.Equal(1, m.Calories);
        }
示例#3
0
        static void Main(string[] args)
        {
            Mike    first_item  = new Mike("Coloss", 500, 43, "Cotton", "TTX", 3);
            Milk    second_item = new Milk("Health", 200, new DateTime(2015, 7, 20), 20, 30);
            Jeans   third_item  = new Jeans("K_jeans", 3000, 40, "cotton", "Santa Maria", true);
            Cleaner fourth_item = new Cleaner("Superclean", 300, 4.5, "plate");
            Sausage fifth_item  = new SausageBuilder().setCompany("MeatGodman").setName("MeatHealth").setPrice(200);



            SimpleBuyer buyer_one = new SimpleBuyer(1);

            buyer_one.AddItemIntoCart(first_item);
            buyer_one.AddItemIntoCart(second_item);
            buyer_one.AddItemIntoCart(third_item);
            buyer_one.AddItemIntoCart(fourth_item);

            CashBox cash_box = CashBox.getInstance();

            cash_box.setState(cashBoxState.WORK);
            cash_box.addCustomerToQueue(buyer_one);
            cash_box.processCustomer();

            Console.ReadLine();
        }
        private void AddMilks(Products products, int quantity)
        {
            var milk = new Milk();

            milk.AddQuantity(quantity);
            products.Add(milk);
        }
示例#5
0
        public AddOrder(Customer customer)
        {
            InitializeComponent();
            ACustomer = customer;
            Coffee                  aCoffee            = new Coffee();
            CoffeeDarkRoast         aDarkRoastCoffee   = new CoffeeDarkRoast();
            SandwichWithBacon       aBaconSandwich     = new SandwichWithBacon();
            SandwichWithEggSalad    aEggSandwich       = new SandwichWithEggSalad();
            SandwichWithRoastedBeef aRoastBeefSandwich = new SandwichWithRoastedBeef();
            Tea       aTea      = new Tea();
            Milk      aMilk     = new Milk();
            Suggar    aSuggar   = new Suggar();
            Sweetener aSweetner = new Sweetener();
            Cheese    aCheese   = new Cheese();
            Mayo      aMayo     = new Mayo();
            Lettuce   aLettuce  = new Lettuce();
            Tomato    aTomato   = new Tomato();

            lbxOrders.Items.Add(aCoffee);
            lbxOrders.Items.Add(aDarkRoastCoffee);
            lbxOrders.Items.Add(aBaconSandwich);
            lbxOrders.Items.Add(aEggSandwich);
            lbxOrders.Items.Add(aRoastBeefSandwich);
            lbxOrders.Items.Add(aTea);
            lbxAdditions.Items.Add(aSweetner);
            lbxAdditions.Items.Add(aMilk);
            lbxAdditions.Items.Add(aSuggar);
            lbxAdditions.Items.Add(aCheese);
            lbxAdditions.Items.Add(aMayo);
            lbxAdditions.Items.Add(aLettuce);
            lbxAdditions.Items.Add(aTomato);
        }
示例#6
0
        private static IList <Milk> GetMilkSearchKeywordsBySql(string safeSql)
        {
            List <Milk> list = new List <Milk>();

            try
            {
                DataTable table = DBHelper.GetDataSet(safeSql);

                foreach (DataRow row in table.Rows)
                {
                    Milk milk = new Milk();
                    milk.Id                 = (int)row["Id"];
                    milk.Name               = (string)row["Name"];
                    milk.CountryOfOrigin    = (string)row["CountryOfOrigin"];
                    milk.Brand              = (string)row["brand"];
                    milk.ContentDescription = (string)row["ContentDescription"];
                    milk.UnitPrice          = (decimal)row["UnitPrice"];
                    milk.DateOfManufacture  = (DateTime)row["DateOfManufacture"];
                    milk.Category           = CategoryService.GetCategoryById((int)row["CategoryId"]);
                    list.Add(milk);
                }

                return(list);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(null);
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            #region Generazione e popolamento menu
            Menu menu = new Menu();
            menu.ListOfToppingsAvailableInMenu = new List <ITopping>();

            GenericTopping gT = new GenericTopping("toppingDProva", "X", 0.56f);
            menu.AddToppingToMenu((ITopping)gT);

            Cocoa       cocoa  = new Cocoa();
            CocoaPowder powder = new CocoaPowder();
            Milk        milk   = new Milk();
            MilkFoam    foam   = new MilkFoam();

            menu.AddToppingToMenu(cocoa);
            menu.AddToppingsToMenu(cocoa, powder, milk, foam);
            #endregion

            foreach (ITopping topping in menu.ListOfToppingsAvailableInMenu.Where((topping) => topping.Price > 0.10f))
            {
                Console.Write($"{topping.Code}\t");
                Console.Write($"{topping.Price:0.00}\t");
                Console.Write($"{topping.Name}\n");
            }
            Console.ReadLine();
            //Test con la lambda/delegate ... fallito miseramente ...
            //DlgMetod provaScrittura(sondaLambda())
            //sondaLambda(txt);
        }
示例#8
0
        public override Product CreateProduct()
        {
            var milk = new Milk("SuperMilk", 100);

            allProducts.Add(milk);
            return(milk);
        }
示例#9
0
 private void AmericanoRadio_CheckedChanged(object sender, EventArgs e)
 {
     if (((RadioButton)sender).Checked == true)
     {
         rAmericano = ((RadioButton)sender).Name;
     }
     if (rAmericano == "NormalAmericano")
     {
         Baverages bev = new Americano();
         string    x   =
             string.Format("{0} - ${1}",
                           bev.GetDescription(),
                           bev.GetPrice() * Convert.ToDouble(AmericanoUpDown.Value));
         AmericanoOrder.Text = x;
     }
     if (rAmericano == "ExtraAmericano")
     {
         Baverages bev = new Americano();
         bev = new Milk(bev);
         string x =
             string.Format("{0} - ${1}",
                           bev.GetDescription(),
                           bev.GetPrice() * Convert.ToDouble(AmericanoUpDown.Value));
         AmericanoOrder.Text = x;
     }
 }
示例#10
0
        public void test_coffee()
        {
            {
                ICoffee coffee = new Espresso();

                Chocolate decoratorChocolate = new Chocolate(coffee);
                decoratorChocolate.AddCondiment();

                Assert.That(coffee.GetPrice() == 3.98);

                Milk decoratorMilk = new Milk(coffee);
                decoratorMilk.AddCondiment();

                Assert.That(coffee.GetPrice() == 5.97);
            }

            {
                ICoffee coffee = new Espresso();

                Chocolate decoratorChocolate = new Chocolate(coffee);
                decoratorChocolate.AddCondiment();

                Milk decoratorMilk = new Milk(decoratorChocolate);
                decoratorMilk.AddCondiment();

                Assert.That(coffee.GetPrice() == 5.97);
            }
        }
示例#11
0
 public void DarkRoastWithMochaWithWhipWithMilk()
 {
     Beverage beverage = new DarkRoast();
     beverage = new Mocha(beverage);
     beverage = new Whip(beverage);
     beverage = new Milk(beverage);
     Assert.AreEqual(1.39, beverage.Cost(),DELTA);
 }
示例#12
0
        public void Milk_Basic_Test()
        {
            Milk milk = new Milk(1, 1.0M);

            var actual = milk.GetOffers();

            Assert.Equal(1.0M, actual);
        }
        public void DescriptionWithMochaAndEspresso()
        {
            DarkRoast          darkRoast                 = new DarkRoast();
            CondimentDecorator darkRoastWithMocha        = new Mocha(darkRoast);
            CondimentDecorator darkRoastWithMochaAndMilk = new Milk(darkRoastWithMocha);

            Assert.That(darkRoastWithMochaAndMilk.Description, Is.EqualTo("The Best Dark Roast, mocha, milk"));
        }
        public void CostIsComputedWithMochaAndEspresso()
        {
            DarkRoast          darkRoast                 = new DarkRoast();
            CondimentDecorator darkRoastWithMocha        = new Mocha(darkRoast);
            CondimentDecorator darkRoastWithMochaAndMilk = new Milk(darkRoastWithMocha);

            Assert.That(darkRoastWithMochaAndMilk.Cost(), Is.EqualTo(3.25));
        }
示例#15
0
 public ActionResult UpdateMilk(Milk milk)
 {
     if (!new BLL.MilkController().UpdateMilk(milk))
     {
         return(HttpNotFound());
     }
     return(RedirectToAction("GetMilkByCattleEarringNumber", new { EarringNumber = milk.CattleID }));
 }
示例#16
0
        public static void Example1()
        {
            Tiger tiger = new Tiger();
            Cat   cat   = new Cat();

            Meat meat = tiger.GetFood();
            Milk milk = cat.GetFood();
        }
示例#17
0
        public void TestCalculateFat()
        {
            var milk = new Milk {
                Gallons = 0.5m, Percent = 0.02m
            };

            Assert.AreEqual(0.01m, milk.Fat);
        }
示例#18
0
 private void ProduceMilk()
 {
     if (milks.Count < MaxCountOfCheeseFactory * 2)
     {
         Milk milk = (Milk)milkLine.Produce();
         milks.Add(milk);
         milks.Add(milk);
     }
 }
        public void DarkRoastWithMochaWithWhipWithMilk()
        {
            Beverage beverage = new DarkRoast();

            beverage = new Mocha(beverage);
            beverage = new Whip(beverage);
            beverage = new Milk(beverage);
            Assert.AreEqual(1.39, beverage.Cost(), DELTA);
        }
        static void Main(string[] args)
        {
            Beverage beverage1 = new DarkRoast();

            beverage1 = new Milk(beverage1);
            beverage1 = new Whip(beverage1);
            Console.WriteLine("Total Price: {0}, Description: {1}",
                              beverage1.Cost(), beverage1.GetDescription);
        }
示例#21
0
        public void ReturnsASingleInstance()
        {
            var food = new Milk();

            Injector.Register <Milk, Milk>(n => food);
            var subject = Injector.Resolve <Milk>();

            Assert.AreEqual(subject, food);
        }
示例#22
0
        private static void Main()
        {
            var myCoffee = new Milk(new Espresso());

            Console.WriteLine($"{myCoffee.Description}: {myCoffee.Cost():F}");
            var newCoffee = new Soy(myCoffee);

            Console.WriteLine($"{newCoffee.Description}: {newCoffee.Cost():F}");
        }
示例#23
0
        private Money ApplyOffer(int numberOfTimesToApplyOffer)
        {
            Money discount = new Money();

            for (int i = 0; i < numberOfTimesToApplyOffer; i++)
            {
                discount += new Milk().Price;
            }
            return(discount);
        }
示例#24
0
        public ActionResult Index()
        {
            //t_Case_Main_Service service = new t_Case_Main_Service();

            //var list = Service_t_Case_Main_Service.GetIQueryable().OrderBy(a => a.RootId).Skip(100).Take(100).ToList();

            IProduct milk = new Milk();

            return(View());
        }
示例#25
0
        static void Main(string[] args)
        {
            IDrink espresso = new Espresso();

            Console.WriteLine($"Drink: {espresso.Description} Price: {espresso.Price}");

            espresso = new Chocolate(espresso);
            espresso = new Milk(espresso);
            Console.WriteLine($"Drink: {espresso.Description} Price: {espresso.Price}");
        }
示例#26
0
        static void Main(string[] args)
        {
            var liquid         = new Milk();
            var powderedCoffee = new InstantCoffeePowder();

            var coffeeMaker = new CoffeeMaker(liquid, powderedCoffee);


            Console.ReadKey();
        }
示例#27
0
        private void AddNewMilk(ShoppingBasket shoppingBasket, int?times = default)
        {
            var product = new Milk
            {
                ProductType = ProductType.MILK,
                Price       = 0.00
            };

            Enumerable.Range(0, times.Value - 1).ToList().ForEach(i => shoppingBasket.Products.Add(product));
        }
示例#28
0
        public void Scenario_3_Test()
        {
            Butter butter = new Butter(0, 0.80M);
            Bread  bread  = new Bread(0, 1.00M, butter);
            Milk   milk   = new Milk(4, 1.15M);

            var actual = butter.GetOffers() + bread.GetOffers() + milk.GetOffers();

            Assert.Equal(3.45M, actual);
        }
示例#29
0
        public void GetMixed()
        {
            Milk   mI = new Milk();
            Coffee Co = new Coffee();

            object s = "巧克力";

            Console.WriteLine(string.Format("{0}{1}{2},得到{3}", mI.Name, Co.Name, mI.Mix(), s));
            Console.ReadKey();
        }
        public void Test()
        {
            DarkRoast darkRoast = new DarkRoast();
            Milk      milk      = new Milk(darkRoast);
            Mocha     mocha     = new Mocha(milk);
            Soy       soy       = new Soy(mocha);
            Whip      whip      = new Whip(soy);

            Assert.Equal("Dark Roast, Milk, Mocha, Soy, Whip",
                         whip.GetDescription());
        }
示例#31
0
        public void MilkNameTest()
        {
            CoffeeMachine coffee_machine = new Coffee();

            coffee_machine = new Milk(coffee_machine);
            string expected = "Кофе, с молоком";
            string actual;

            actual = coffee_machine.Name;
            Assert.AreEqual(expected, actual);
        }
示例#32
0
    public static void Main(string[] args)
    {
        Coffee c = new SimpleCoffee();
          Console.WriteLine("Cost: " + c.getCost() + ";");

          c = new Milk(c);
          Console.WriteLine("Cost: " + c.getCost() + ";");

          c = new Sugar(c);
          Console.WriteLine("Cost: " + c.getCost() + ";");

          c = new SimpleCoffee();
          c = new Milk(new Sugar(c)); //shows the actual decoration
          Console.WriteLine("Cost: " + c.getCost() + ";");
    }
 partial void UpdateMilk(Milk instance);
 partial void InsertMilk(Milk instance);
示例#35
0
 public Item(Drink drink, Size size, Milk milk)
 {
     _milk = milk;
     _drink = drink;
     _size = size;
 }
示例#36
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Milk = (Milk)reader.ReadEncodedInt();
            m_Paste = (CheesePaste)reader.ReadEncodedInt();
            m_Taste = (CheeseTaste)reader.ReadEncodedInt();
            m_Quality = (CheeseQuality)reader.ReadEncodedInt();
            m_Cook = reader.ReadMobile();
        }
示例#37
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
            m_Content = (Milk)reader.ReadEncodedInt();
            m_TimeStart = reader.ReadDateTime();
            m_MaxQuantity = reader.ReadInt();
            m_Quantity = reader.ReadInt();
            m_CookingValue = reader.ReadDouble();
        }
 partial void DeleteMilk(Milk instance);