Example #1
0
            public void TestCreateServingAsync()
            {
                ContextSeeders.Seed();
                var sbo = new ServingBusinessObject();

                var rbo    = new RestaurantBusinessObject();
                var mealbo = new MealBusinessObject();
                var drbo   = new DietaryRestrictionBusinessObject();
                var mbo    = new MenuBusinessObject();
                var cbo    = new CourseBusinessObject();
                var dbo    = new DishBusinessObject();

                var restaurant = new Restaurant("a", "b", "c", "d", "f", 6);
                var meal       = new Meal("a", "b", "c");
                var dr         = new DietaryRestriction("ok");
                var menu       = new Menu(DateTime.Now, restaurant.Id, meal.Id);
                var course     = new Course("yes");
                var dish       = new Dish("uh", dr.Id);

                rbo.Create(restaurant);
                mealbo.Create(meal);
                drbo.Create(dr);
                mbo.Create(menu);
                cbo.Create(course);
                dbo.Create(dish);

                var serving = new Serving(menu.Id, course.Id, dish.Id);

                var resCreate = sbo.CreateAsync(serving).Result;
                var resGet    = sbo.ReadAsync(serving.Id).Result;

                Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
            }
Example #2
0
        public void TestUpdateStaffTitleAsync()
        {
            ContextSeeders.Seed();

            var boStaffRecord = new StaffRecordBusinessObject();
            var staffRecord   = boStaffRecord.List().Result.First();

            var boTitle = new TitleBusinessObject();
            var title   = boTitle.List().Result.First();

            var mbo     = new StaffTitleBusinessObject();
            var resList = mbo.List();

            var item = resList.Result.FirstOrDefault();

            var newRestaurant = new StaffTitle(staffRecord.Id, title.Id, DateTime.Parse("14/07/2020"), DateTime.Parse("14/07/2021"));

            item.StartDate = newRestaurant.StartDate;
            item.EndDate   = newRestaurant.EndDate;

            var resUpdate = mbo.UpdateAsync(item).Result;

            resList = mbo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().StartDate == newRestaurant.StartDate &&
                          resList.Result.First().EndDate == newRestaurant.EndDate);
        }
Example #3
0
        public void TestUpdateDish()
        {
            ContextSeeders.Seed();
            var dbo     = new DishBusinessObject();
            var resList = dbo.List();
            var item    = resList.Result.FirstOrDefault();


            var drbo = new DietaryRestrictionBusinessObject();


            var dr      = new DietaryRestriction("vegan");
            var newDish = new Dish("ok", dr.Id);


            drbo.Create(dr);


            item.Name = newDish.Name;
            item.DietaryRestrictionId = newDish.DietaryRestrictionId;

            var resUpdate = dbo.Update(item);

            resList = dbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().DietaryRestrictionId == newDish.DietaryRestrictionId &&
                          resList.Result.First().Name == newDish.Name);
        }
        public void TestUpdatePerson()
        {
            ContextSeeders.Seed();
            var pbo     = new PersonBusinessObject();
            var resList = pbo.List();
            var item    = resList.Result.FirstOrDefault();

            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _newPerson = new Person(3654324444, 1111111, "Marco", "Figueirinha", DateTime.UtcNow, _lennyouseUser.Id);

            item.VatNumber       = _newPerson.VatNumber;
            item.PhoneNumber     = _newPerson.PhoneNumber;
            item.FirstName       = _newPerson.FirstName;
            item.LastName        = _newPerson.LastName;
            item.BirthDate       = _newPerson.BirthDate;
            item.LennyouseUserId = _newPerson.LennyouseUserId;

            var resUpdate = pbo.Update(item);

            resList = pbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().VatNumber == _newPerson.VatNumber &&
                          resList.Result.First().PhoneNumber == _newPerson.PhoneNumber &&
                          resList.Result.First().FirstName == _newPerson.FirstName &&
                          resList.Result.First().LastName == _newPerson.LastName &&
                          resList.Result.First().BirthDate == _newPerson.BirthDate &&
                          resList.Result.First().LennyouseUserId == _newPerson.LennyouseUserId
                          );
        }
Example #5
0
        public void TestCreateStaffRecordAsync()
        {
            ContextSeeders.Seed();
            var srbo = new StaffRecordBusinessObject();
            var pbo  = new PersonBusinessObject();
            var rbo  = new RestaurantBusinessObject();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person = new Person(1234321, 23432456, "Marco", "Figueirnha", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);

            var _restaurant = new Restaurant("Tasca do sol", "Bairro Alto 2", "12h", "00h", "Mondays", 3);

            rbo.Create(_restaurant);

            var _staffRecord = new StaffRecord(DateTime.UtcNow, DateTime.UtcNow, _person.Id, _restaurant.Id);

            var resCreate = srbo.CreateAsync(_staffRecord).Result;
            var resGet    = srbo.ReadAsync(_staffRecord.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestUpdateRestaurantAsync()
        {
            ContextSeeders.Seed();
            var mbo     = new RestaurantBusinessObject();
            var resList = mbo.List();
            var item    = resList.Result.FirstOrDefault();

            var newRestaurant = new Restaurant("Bartolomeu", "Rua tulipa, numero 234, Ericeira", "11:00", "22:00",
                                               "Segunfa-feira", 20);

            item.Name          = newRestaurant.Name;
            item.Address       = newRestaurant.Address;
            item.OpenningHours = newRestaurant.OpenningHours;
            item.ClosingHours  = newRestaurant.ClosingHours;
            item.ClosingDays   = newRestaurant.ClosingDays;
            item.TableCount    = newRestaurant.TableCount;


            var resUpdate = mbo.UpdateAsync(item).Result;

            resList = mbo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().Name == newRestaurant.Name &&
                          resList.Result.First().Address == newRestaurant.Address &&
                          resList.Result.First().OpenningHours == newRestaurant.OpenningHours &&
                          resList.Result.First().ClosingHours == newRestaurant.ClosingHours &&
                          resList.Result.First().ClosingDays == newRestaurant.ClosingDays &&
                          resList.Result.First().TableCount == newRestaurant.TableCount);
        }
        public void TestCreateClientRecordAsync()
        {
            ContextSeeders.Seed();
            var crbo = new ClientRecordBusinessObject();
            var lubo = new LennyouseUserBusinessObject();
            var pbo  = new PersonBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person = new Person(123456789, 934657823, "Miguel", "Silva", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);

            var rbo        = new RestaurantBusinessObject();
            var _resturant = new Restaurant("Dom Pedro", "Rua das Flores 2", "2 p.m", "9 p.m", "Fridays", 2);

            rbo.Create(_resturant);

            var _clientRecord = new ClientRecord(DateTime.UtcNow, _person.Id, _resturant.Id);

            var resCreate = crbo.CreateAsync(_clientRecord).Result;
            var resGet    = crbo.ReadAsync(_clientRecord.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateBookingAsync()
        {
            ContextSeeders.Seed();
            var crbo  = new ClientRecordBusinessObject();
            var bbo   = new BookingBusinessObject();
            var pbo   = new PersonBusinessObject();
            var rbo   = new RestaurantBusinessObject();
            var lhubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());
            var newP           = new Person(11111, 11111, "ok", "ok", DateTime.UtcNow, _lennyouseUser.Id);
            var newR           = new Restaurant("ok", "ok", "ok", "ok", "ok", 5);



            var cr      = new ClientRecord(DateTime.UtcNow, newP.Id, newR.Id);
            var booking = new Booking(cr.Id, DateTime.UtcNow);



            crbo.Create(cr);
            pbo.Create(newP);
            rbo.Create(newR);
            lhubo.Create(_lennyouseUser);

            var resCreate = bbo.CreateAsync(booking).Result;
            var resGet    = bbo.ReadAsync(booking.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Example #9
0
        public void TestUpdateMenu()
        {
            ContextSeeders.Seed();
            var mbo     = new MenuBusinessObject();
            var resList = mbo.List();
            var item    = resList.Result.FirstOrDefault();

            var rbo    = new RestaurantBusinessObject();
            var mealbo = new MealBusinessObject();

            var restaurant = new Restaurant("a", "b", "c", "d", "f", 6);
            var meal       = new Meal("a", "b", "c");

            rbo.Create(restaurant);
            mealbo.Create(meal);

            var newMenu = new Menu(DateTime.Now, restaurant.Id, meal.Id);

            item.Date         = newMenu.Date;
            item.RestaurantId = newMenu.RestaurantId;
            item.MealId       = newMenu.MealId;

            var resUpdate = mbo.Update(item);

            resList = mbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().Date == newMenu.Date && resList.Result.First().RestaurantId == newMenu.RestaurantId &&
                          resList.Result.First().MealId == newMenu.MealId);
        }
Example #10
0
        public void TestListDietaryRestrictionAsync()
        {
            ContextSeeders.Seed();
            var bo      = new DietaryRestrictionBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestListClientRecordAsync()
        {
            ContextSeeders.Seed();
            var bo      = new ClientRecordBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Example #12
0
        public void TestListLennyouseUserAsync()
        {
            ContextSeeders.Seed();
            var bo      = new LennyouseUserBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestReadRestaurant()
        {
            ContextSeeders.Seed();
            var bo      = new StaffTitleBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result != null);
        }
        public void TestListRestaurant()
        {
            ContextSeeders.Seed();
            var bo      = new RestaurantBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestCreateRestaurant()
        {
            ContextSeeders.Seed();
            var bo         = new RestaurantBusinessObject();
            var restaurant = new Restaurant("Lennyouse", "Rua alhusta, numero 456, Lisboa", "12:00", "23:00", "Segunda", 30);
            var resCreate  = bo.Create(restaurant);

            Assert.IsTrue(resCreate.Success);
        }
        public void TestDeleteRestaurantAsync()
        {
            ContextSeeders.Seed();
            var bo        = new RestaurantBusinessObject();
            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);
        }
        public void TestCreateTitle()
        {
            ContextSeeders.Seed();
            var bo    = new TitleBusinessObject();
            var title = new Title("Kitchen chef", "Profissional que organiza, coordena, dirige e verifica os" +
                                  " trabalhos de cozinha em restaurantes, hotéis e estabelecimentos similares.", "Ronaldo");
            var resCreate = bo.Create(title);

            Assert.IsTrue(resCreate.Success);
        }
Example #18
0
        public void TestDeleteStaffTitle()
        {
            ContextSeeders.Seed();
            var bo        = new StaffTitleBusinessObject();
            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);
        }
Example #19
0
        public void TestCreateCourseAsync()
        {
            ContextSeeders.Seed();
            var mbo = new CourseBusinessObject();

            var course    = new Course("pizza");
            var resCreate = mbo.CreateAsync(course).Result;
            var resGet    = mbo.ReadAsync(course.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Example #20
0
        public void TestCreateMealAsync()
        {
            ContextSeeders.Seed();
            var mbo = new MealBusinessObject();

            var meal      = new Meal("pizza", "7pm", "11pm");
            var resCreate = mbo.CreateAsync(meal).Result;
            var resGet    = mbo.ReadAsync(meal.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Example #21
0
        public void TestCreateDietaryRestrictionAsync()
        {
            ContextSeeders.Seed();
            var mbo = new DietaryRestrictionBusinessObject();

            var dietaryRestriction = new DietaryRestriction("Vegan");
            var resCreate          = mbo.CreateAsync(dietaryRestriction).Result;
            var resGet             = mbo.ReadAsync(dietaryRestriction.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Example #22
0
        public void TestCreateLennyouseUserAsync()
        {
            ContextSeeders.Seed();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            var resCreate = lubo.CreateAsync(_lennyouseUser).Result;
            var resGet    = lubo.ReadAsync(_lennyouseUser.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestDeleteClientRecordAsync()
        {
            ContextSeeders.Seed();
            var bo = new ClientRecordBusinessObject();

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

            resList = bo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
Example #24
0
        public void TestDeleteDietaryRestrictionAsync()
        {
            ContextSeeders.Seed();
            var bo = new DietaryRestrictionBusinessObject();

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

            resList = bo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
Example #25
0
        public void TestDeleteLennyouseUserAsync()
        {
            ContextSeeders.Seed();
            var bo = new LennyouseUserBusinessObject();

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

            resList = bo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success);
        }
        public void TestUpdateRestaurant()
        {
            ContextSeeders.Seed();
            var bo      = new RestaurantBusinessObject();
            var resList = bo.List();
            var item    = resList.Result.FirstOrDefault();

            item.Name = "Ratatouille";
            var resUpdate  = bo.Update(item);
            var resNotList = bo.List().Result.Where(x => !x.IsDeleted);

            Assert.IsTrue(resUpdate.Success && resNotList.First().Name == "Ratatouille");
        }
Example #27
0
        public void TestUpdateStaffTitle()
        {
            ContextSeeders.Seed();
            var bo      = new StaffTitleBusinessObject();
            var resList = bo.List();
            var item    = resList.Result.FirstOrDefault();

            item.EndDate = DateTime.Parse("13/07/2022");
            var resUpdate  = bo.Update(item);
            var resNotList = bo.List().Result.Where(x => !x.IsDeleted);

            Assert.IsTrue(resUpdate.Success && resNotList.First().EndDate == DateTime.Parse("13/07/2022"));
        }
Example #28
0
        public void TestCreateStaffTitle()
        {
            ContextSeeders.Seed();
            var boStaffRecord = new StaffRecordBusinessObject();
            var staffRecord   = boStaffRecord.List().Result.First();

            var boTitle = new TitleBusinessObject();
            var title   = boTitle.List().Result.First();

            var bo         = new StaffTitleBusinessObject();
            var staffTitle = new StaffTitle(staffRecord.Id, title.Id, DateTime.Parse("13/07/2020"), DateTime.Parse("13/07/2021"));;
            var resCreate  = bo.Create(staffTitle);

            Assert.IsTrue(resCreate.Success);
        }
        public void TestCreatePersonAsync()
        {
            ContextSeeders.Seed();
            var pbo  = new PersonBusinessObject();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person   = new Person(3654324444, 0000000, "Marco", "Figueirnha", DateTime.UtcNow, _lennyouseUser.Id);
            var resCreate = pbo.CreateAsync(_person).Result;
            var resGet    = pbo.ReadAsync(_person.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Example #30
0
        public void TestCreateDish()
        {
            ContextSeeders.Seed();
            var drbo = new DietaryRestrictionBusinessObject();
            var dbo  = new DishBusinessObject();

            var dr   = new DietaryRestriction("vegan");
            var dish = new Dish("ok", dr.Id);


            drbo.Create(dr);

            var resCreate = dbo.Create(dish);
            var resGet    = dbo.Read(dish.Id);

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