public void TestDeleteClientRecord()
        {
            RestaurantSeeder.SeedCountries();
            var bo         = new StaffRecordBusinessObject();
            var resList    = bo.List();
            var resDelete  = bo.Delete(resList.Result.First().Id);
            var resNotList = bo.List().Result.Where(x => !x.IsDeleted).ToList();

            Assert.IsTrue(resDelete.Success && resNotList.Count == 0);
        }
Пример #2
0
        public void TestDeleteStaffRecord()
        {
            ContextSeeders.Seed();
            var bo = new StaffRecordBusinessObject();

            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 TestUpdateClientRecord()
        {
            RestaurantSeeder.SeedCountries();
            var bo      = new StaffRecordBusinessObject();
            var resList = bo.List();
            var item    = resList.Result.FirstOrDefault();

            item.BeginDate = DateTime.Parse("2020/05/05");
            var resUpdate  = bo.Update(item);
            var resNotList = bo.List().Result.Where(x => !x.IsDeleted);

            Assert.IsTrue(resUpdate.Success && resNotList.First().BeginDate == DateTime.Parse("2020/05/05"));
        }
Пример #4
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);
        }
Пример #5
0
        public void TestListStaffRecord()
        {
            RestaurantSeeder.Seed();
            var bo      = new StaffRecordBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Пример #6
0
        public void TestDeleteStaffRecord()
        {
            RestaurantSeeder.Seed();
            var bo        = new StaffRecordBusinessObject();
            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);
        }
Пример #7
0
        public void TestUpdateStaffRecord()
        {
            ContextSeeders.Seed();
            var srbo    = new StaffRecordBusinessObject();
            var resList = srbo.List();
            var item    = resList.Result.FirstOrDefault();

            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(3654324444, 0000000, "Marco", "Figueirnha", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);

            var _restaurant = new Restaurant("Tasca da Lua", "Bairro Alto 2", "12h", "00h", "Mondays", 7);

            rbo.Create(_restaurant);


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

            item.BeginDate    = _newStaffRecord.BeginDate;
            item.EndDate      = _newStaffRecord.EndDate;
            item.PersonId     = _newStaffRecord.PersonId;
            item.RestaurantId = _newStaffRecord.RestaurantId;

            var resUpdate = srbo.Update(item);

            resList = srbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().BeginDate == _newStaffRecord.BeginDate &&
                          resList.Result.First().EndDate == _newStaffRecord.EndDate &&
                          resList.Result.First().PersonId == _newStaffRecord.PersonId &&
                          resList.Result.First().RestaurantId == _newStaffRecord.RestaurantId
                          );
        }
        public void TestCreateAndReadStaffTitleRecordAsync()
        {
            RestaurantSeeder.SeedCountries();
            var bo        = new StaffTitleBusinessObject();
            var tbo       = new TitleBusinessObject();
            var tl        = tbo.List().Result.First();
            var sbo       = new StaffRecordBusinessObject();
            var sr        = sbo.List().Result.First();
            var st        = new StaffTitle(DateTime.Parse("2015/05/05"), DateTime.Parse("2020/05/05"), tl.Id, sr.Id);
            var resCreate = bo.CreateAsync(st).Result;
            var resGet    = bo.ReadAsync(st.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Пример #9
0
        public void TestUpdateStaffRecord()
        {
            RestaurantSeeder.Seed();
            var bo      = new StaffRecordBusinessObject();
            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);
        }
Пример #10
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 ActionResult <List <StaffRecordViewModel> > List()
        {
            var res = _bo.List();

            if (!res.Success)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
            var list = new List <StaffRecordViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(StaffRecordViewModel.Parse(item));
            }
            return(list);
        }
Пример #12
0
        public void TestCreateAndListStaffTitle()
        {
            RestaurantSeeder.Seed();
            var sbo  = new StaffTitleBusinessObject();
            var tbo  = new TitleBusinessObject();
            var srbo = new StaffRecordBusinessObject();

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


            var dr        = new StaffTitle(DateTime.Now, DateTime.Now, sr.Id, t.Id);
            var resCreate = sbo.Create(dr);
            var resGet    = sbo.Read(dr.Id);

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