Ejemplo n.º 1
0
        public void TestDeleteCourse()
        {
            ContextSeeders.Seed();
            var bo = new CourseBusinessObject();

            var resList   = bo.List();
            var resDelete = bo.Delete(resList.Result.First().Id);

            resList = bo.List();

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
Ejemplo n.º 2
0
        public void TestListCourse()
        {
            ContextSeeders.Seed();
            var bo      = new CourseBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Ejemplo n.º 3
0
        public void TestListCourse()
        {
            RestaurantSeeder.Seed();
            var bo      = new CourseBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count > 0);
        }
Ejemplo n.º 4
0
        public void TestUpdateCourse()
        {
            ContextSeeders.Seed();
            var mbo     = new CourseBusinessObject();
            var resList = mbo.List();
            var item    = resList.Result.FirstOrDefault();

            var newCourse = new Course("lasagna");

            item.Name = newCourse.Name;


            var resUpdate = mbo.Update(item);

            resList = mbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().Name == newCourse.Name);
        }
Ejemplo n.º 5
0
        public void TestUpdateCourse()
        {
            RestaurantSeeder.Seed();
            var bo      = new CourseBusinessObject();
            var resList = bo.List();
            var item    = resList.Result.FirstOrDefault();

            item.Name = "another";
            var resUpdate = bo.Update(item);

            resList = bo.ListNonDeleted();
            Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Name == "another");
        }
        public ActionResult <List <CourseViewModel> > List()
        {
            var res = _bo.List();

            if (!res.Success)
            {
                return(InternalServerError());
            }
            var list = new List <CourseViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(CourseViewModel.Parse(item));
            }
            return(list);
        }
Ejemplo n.º 7
0
        public void TestCreateAndListServing()
        {
            RestaurantSeeder.Seed();
            var cbo = new CourseBusinessObject();
            var dbo = new DishBusinessObject();
            var mbo = new MenuBusinessObject();
            var sbo = new ServingBusinessObject();

            var c = cbo.List().Result.First();
            var d = dbo.List().Result.First();
            var m = mbo.List().Result.First();

            var dr        = new Serving(m.Id, d.Id, c.Id);
            var resCreate = sbo.Create(dr);
            var resGet    = sbo.Read(dr.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }