Esempio n. 1
0
        public void AddComment()
        {
            Facade = new FacadePizza()
            {
                Context = new PizzeriaContext(options)
                {
                    Test = true
                }
            };
            Facadeuser = new FacadeUsers()
            {
                Context = new PizzeriaContext(options)
                {
                    Test = true
                }
            };
            Errors err  = Facadeuser.Insert("Loguin", "Password", "Name", "Surname", "Email");
            User   user = Facadeuser.GetUser("Loguin");

            Assert.Equal(user.Loguin, "Loguin");
            String pizzaId = Facade.AddPizza("name", "photo");

            Assert.NotEqual(pizzaId, "Error");
            Facade.AddComment(pizzaId, user.UserId, "blablabñlablabla");
        }
Esempio n. 2
0
 public void AddIngredient()
 {
     Facade = new FacadePizza()
     {
         Context = new PizzeriaContext(options)
         {
             Test = true
         }
     };
     Facade.AddPizza("name", "photo");
 }
Esempio n. 3
0
        public void InsertPizzaNoError()
        {
            Facade = new FacadePizza()
            {
                Context = new PizzeriaContext(options)
                {
                    Test = true
                }
            };
            String id = Facade.AddPizza("Loguin", "Path");

            Assert.NotEqual("Error", id);
        }
        public string AddPizza(String name, IFormFile f)
        {
            if (f == null)
            {
                return("Error");
            }
            var filePath = "img/" + f.FileName;

            if (f.Length > 0)
            {
                using (var stream = new FileStream(filePath, FileMode.Create))
                {
                    f.CopyTo(stream);
                }
            }
            String id = FaPizza.AddPizza(name, filePath);

            return(id);
        }