Beispiel #1
0
        public void TestMessagePizzaMargharitaSideDisch()
        {
            //Arrange

            Pizza.PriceAll priceAll = new Pizza.PriceAll()
            {
                Price    = "28zł",
                Comments = "",
                Date     = "2020-07-09 17:27:38"
            };


            Pizza.Dish pizza = new Pizza.Dish
            {
                Name        = name.MarghPrice,
                Price       = "28zł",
                SidesDishes = Sides(name.DoubelCheesePrice, name.SalamiPrice, name.HamPrice, name.MushroomsPrice)
            };


            Pizza.Order order = new Pizza.Order
            {
                PriceAll = priceAll
            };
            order.AddDishToListDisch(pizza);


            Pizza.EmailMessage message = new Pizza.EmailMessage(order);


            string test = "###################################################\n#\n#               2020-07-09 17:27:38                \n#                     Cena: 28zł                  \n#\n###################################################" +
                          "\n###################################################\n#\n# Margheritta -20zł\n# Podwójny Ser -2zł\n# Salami -2zł\n# Szynka -2zł\n# Pieczarki -2zł\n# Cenna za danie: 28zł\n#\n###################################################\nUwagi do zamówienia: \n";

            Assert.AreEqual(test, message.WriteBill());
        }
Beispiel #2
0
        public void TestMessagePizzaMargharita()
        {
            //Arrange

            Pizza.PriceAll priceAll = new Pizza.PriceAll()
            {
                Price    = "20zł",
                Comments = "",
                Date     = "2020-07-09 17:22:26"
            };

            Pizza.Dish pizza = new Pizza.Dish
            {
                Name  = name.Margh,
                Price = "20zł"
            };


            Pizza.Order order = new Pizza.Order
            {
                PriceAll = priceAll
            };
            order.AddDishToListDisch(pizza);


            Pizza.EmailMessage message = new Pizza.EmailMessage(order);


            string test = "###################################################\n#\n#               2020-07-09 17:22:26                \n#                     Cena: 20zł                  \n#\n###################################################" +
                          "\n###################################################\n#\n# Margheritta\n# Cenna za danie: 20zł\n#\n###################################################\nUwagi do zamówienia: \n";

            Assert.AreEqual(test, message.WriteBill());
        }
Beispiel #3
0
        private string AddPriceAll(PriceAll priceAll)
        {
            string stPriceAll = name.PriceAllBeginning + "\n";

            stPriceAll += name.PriceAll + priceAll.Price + "\n";
            stPriceAll += name.Date + priceAll.Date + "\n";
            stPriceAll += name.Comments + priceAll.Comments + "\n";
            stPriceAll += name.PriceAllEnd + "\n";
            return(stPriceAll);
        }
Beispiel #4
0
        string WritePriceAll(PriceAll priceAll)
        {
            string priceAllEmail = "";

            priceAllEmail += LinesHashAndNewLines() + OneHashAndNewLine();
            priceAllEmail += Data(priceAll);
            priceAllEmail += NamePrice();
            priceAllEmail += OneHashAndNewLine();
            priceAllEmail += LinesHashAndNewLines();
            return(priceAllEmail);
        }
Beispiel #5
0
        private void AddPriceAll(string order, PriceAll priceAll)
        {
            try
            {
                int    idexEnd             = order.IndexOf(name.PriceAllEnd);
                string stPriceAll          = order.Substring(0, idexEnd);
                int    indexComments       = stPriceAll.IndexOf(name.Comments) + name.Comments.Length;
                int    indexCommentsRemove = stPriceAll.IndexOf(name.Comments);
                int    indexData           = stPriceAll.IndexOf(name.Date) + name.Date.Length;
                int    indexDataRemove     = stPriceAll.IndexOf(name.Date);
                int    indexPriceAll       = stPriceAll.IndexOf(name.PriceAll) + name.PriceAll.Length;

                priceAll.Comments = RemoveWhiteChar(stPriceAll.Substring(indexComments));
                stPriceAll        = RemoveWorkAndTextToEnd(stPriceAll, indexCommentsRemove);
                priceAll.Date     = RemoveWhiteChar(stPriceAll.Substring(indexData));
                stPriceAll        = RemoveWorkAndTextToEnd(stPriceAll, indexDataRemove);
                priceAll.Price    = RemoveWhiteChar(stPriceAll.Substring(indexPriceAll));
            }
            catch (Exception ex)
            {
                RecordOfExceptions.Save(Convert.ToString(ex), "AddPriceAll");
            }
        }
Beispiel #6
0
        string Data(PriceAll priceAll)
        {
            string data = String.Format("# {0,33}{1,16}", priceAll.Date, " ") + "\n";

            return(data);
        }
Beispiel #7
0
 public EmailMessage(Order order)
 {
     this.listDishes = order.ListDishes;
     this.priceAll   = order.PriceAll;
 }
Beispiel #8
0
 public Order()
 {
     listDisch = new List <Dish>();
     priceAll  = new PriceAll();
 }