示例#1
0
        public void TestListRestaurantAsync()
        {
            RestaurantSeeder.Seed();
            var bo      = new RestaurantBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
示例#2
0
        public void TestListClientRecord()
        {
            RestaurantSeeder.Seed();
            var bo      = new ClientRecordBusinessObject();
            var resList = bo.List();

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

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
示例#4
0
        public void TestListServingAsync()
        {
            RestaurantSeeder.Seed();
            var bo      = new ServingBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count > 0);
        }
示例#5
0
        public void TestListDietaryRestrictionAsync()
        {
            RestaurantSeeder.Seed();
            var bo      = new DietaryRestrictionBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count > 0);
        }
示例#6
0
        public void TestCreateAndListPersonAsync()
        {
            RestaurantSeeder.Seed();
            var bo        = new PersonBusinessObject();
            var dr        = new Person(DateTime.Now, "A", "B", 1203, 1203);
            var resCreate = bo.CreateAsync(dr).Result;
            var resGet    = bo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#7
0
        public void TestCreateAndListCourse()
        {
            RestaurantSeeder.Seed();
            var bo        = new CourseBusinessObject();
            var dr        = new Course("Vegetarian");
            var resCreate = bo.Create(dr);
            var resGet    = bo.Read(dr.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#8
0
        public void TestDeleteClientRecord()
        {
            RestaurantSeeder.Seed();
            var bo        = new ClientRecordBusinessObject();
            var resList   = bo.List();
            var resDelete = bo.Delete(resList.Result.First().Id);

            resList = bo.ListNonDeleted();
            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == 0);
        }
示例#9
0
        public void TestCreateAndListDietaryRestrictionAsync()
        {
            RestaurantSeeder.Seed();
            var bo        = new DietaryRestrictionBusinessObject();
            var dr        = new DietaryRestriction("Vegetarian");
            var resCreate = bo.CreateAsync(dr).Result;
            var resGet    = bo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#10
0
        public void TestCreateAndListRestaurantAsync()
        {
            RestaurantSeeder.Seed();
            var dbo       = new RestaurantBusinessObject();
            var dr        = new Restaurant("asdasd", "owewq", "123", "1232", "23ed", 4);
            var resCreate = dbo.CreateAsync(dr).Result;
            var resGet    = dbo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#11
0
        public void TestDeleteRestaurantAsync()
        {
            RestaurantSeeder.Seed();
            var bo        = new RestaurantBusinessObject();
            var resList   = bo.ListAsync().Result;
            var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result;

            resList = bo.ListNonDeletedAsync().Result;
            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == 0);
        }
示例#12
0
        public void TestCreateAndListMealAsync()
        {
            RestaurantSeeder.Seed();
            var bo        = new MealBusinessObject();
            var dr        = new Meal("Vegetarian", "19", "20");
            var resCreate = bo.CreateAsync(dr).Result;
            var resGet    = bo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#13
0
        public void TestDeleteServing()
        {
            RestaurantSeeder.Seed();
            var bo        = new ServingBusinessObject();
            var resList   = bo.List();
            var total     = resList.Result.Count;
            var resDelete = bo.Delete(resList.Result.First().Id);

            resList = bo.ListNonDeleted();
            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == total - 1);
        }
示例#14
0
        public void TestDeleteDietaryRestrictionAsync()
        {
            RestaurantSeeder.Seed();
            var bo        = new DietaryRestrictionBusinessObject();
            var resList   = bo.ListAsync().Result;
            var total     = resList.Result.Count;
            var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result;

            resList = bo.ListNonDeletedAsync().Result;
            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == total - 1);
        }
示例#15
0
        public void TestCreateAndListDishAsync()
        {
            RestaurantSeeder.Seed();
            var dbo  = new DishBusinessObject();
            var drbo = new DietaryRestrictionBusinessObject();
            var firstDietaryRestriction = drbo.ListAsync().Result.Result.First();
            var dr        = new Dish("Vegetarian", firstDietaryRestriction.Id);
            var resCreate = dbo.CreateAsync(dr).Result;
            var resGet    = dbo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#16
0
        public void TestUpdateRestaurantAsync()
        {
            RestaurantSeeder.Seed();
            var bo      = new RestaurantBusinessObject();
            var resList = bo.ListAsync().Result;
            var item    = resList.Result.FirstOrDefault();

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

            resList = bo.ListNonDeletedAsync().Result;
            Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Name == "another");
        }
示例#17
0
        public void TestUpdateDietaryRestriction()
        {
            RestaurantSeeder.Seed();
            var bo      = new DietaryRestrictionBusinessObject();
            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");
        }
示例#18
0
        public void TestCreateAndListBookingAsync()
        {
            RestaurantSeeder.Seed();
            var cbo = new ClientRecordBusinessObject();
            var bbo = new BookingBusinessObject();

            var c = cbo.ListAsync().Result.Result.First();

            var dr        = new Booking(DateTime.Now, c.Id);
            var resCreate = bbo.CreateAsync(dr).Result;
            var resGet    = bbo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#19
0
        public void TestUpdateStaffTitle()
        {
            RestaurantSeeder.Seed();
            var bo      = new StaffTitleBusinessObject();
            var resList = bo.List();
            var item    = resList.Result.FirstOrDefault();
            var now     = DateTime.Now;

            item.BeginDate = now;
            var resUpdate = bo.Update(item);

            resList = bo.ListNonDeleted();
            Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().BeginDate == now);
        }
示例#20
0
        public void TestUpdateClientRecordAsync()
        {
            RestaurantSeeder.Seed();
            var bo      = new ClientRecordBusinessObject();
            var resList = bo.ListAsync().Result;
            var item    = resList.Result.FirstOrDefault();
            var now     = DateTime.Now;

            item.RegisterDate = now;
            var resUpdate = bo.UpdateAsync(item).Result;

            resList = bo.ListNonDeletedAsync().Result;
            Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().RegisterDate == now);
        }
示例#21
0
        public void TestUpdateServing()
        {
            RestaurantSeeder.Seed();
            var bo        = new ServingBusinessObject();
            var mbo       = new MenuBusinessObject();
            var resList   = bo.List();
            var item      = resList.Result.FirstOrDefault();
            var newMenuId = mbo.List().Result.First(x => x.Id != item.MenuId).Id;

            item.MenuId = newMenuId;
            var resUpdate = bo.Update(item);

            resList = bo.ListNonDeleted();
            Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().MenuId == newMenuId);
        }
示例#22
0
        public void TestCreateAndListMenuAsync()
        {
            RestaurantSeeder.Seed();
            var mbo  = new MealBusinessObject();
            var rbo  = new RestaurantBusinessObject();
            var mebo = new MenuBusinessObject();

            var m = mbo.ListAsync().Result.Result.First();
            var r = rbo.ListAsync().Result.Result.First();

            var dr        = new Menu(DateTime.Now, r.Id, m.Id);
            var resCreate = mebo.CreateAsync(dr).Result;
            var resGet    = mebo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#23
0
        public void TestCreateAndListStaffTitleAsync()
        {
            RestaurantSeeder.Seed();
            var sbo  = new StaffTitleBusinessObject();
            var tbo  = new TitleBusinessObject();
            var srbo = new StaffRecordBusinessObject();

            var t  = tbo.ListAsync().Result.Result.First();
            var sr = srbo.ListAsync().Result.Result.First();


            var dr        = new StaffTitle(DateTime.Now, DateTime.Now, sr.Id, t.Id);
            var resCreate = sbo.CreateAsync(dr).Result;
            var resGet    = sbo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#24
0
        public void TestCreateAndListClientRecordAsync()
        {
            RestaurantSeeder.Seed();
            var sbo = new ClientRecordBusinessObject();
            var rbo = new RestaurantBusinessObject();
            var pbo = new PersonBusinessObject();

            var r = rbo.ListAsync().Result.Result.First();
            var p = pbo.ListAsync().Result.Result.First();


            var dr        = new ClientRecord(p.Id, r.Id, DateTime.Now);
            var resCreate = sbo.CreateAsync(dr).Result;
            var resGet    = sbo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#25
0
        public void TestCreateAndListServingAsync()
        {
            RestaurantSeeder.Seed();
            var cbo = new CourseBusinessObject();
            var dbo = new DishBusinessObject();
            var mbo = new MenuBusinessObject();
            var sbo = new ServingBusinessObject();

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

            var dr        = new Serving(m.Id, d.Id, c.Id);
            var resCreate = sbo.CreateAsync(dr).Result;
            var resGet    = sbo.ReadAsync(dr.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
示例#26
0
 static void Main(string[] args)
 {
     RestaurantSeeder.Seed();
 }