public void TestListStaffRecordAsync() { RestaurantSeeder.SeedCountries(); var bo = new StaffRecordBusinessObject(); var resList = bo.ListAsync().Result; Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestDeleteStaffRecordAsync() { RestaurantSeeder.SeedCountries(); var bo = new StaffRecordBusinessObject(); var resList = bo.ListAsync().Result; var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListUnDeletedAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == 0); }
public void TestDeleteStaffRecordAsync() { ContextSeeders.Seed(); var bo = new StaffRecordBusinessObject(); 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); }
public void TestUpdateStaffRecordAsync() { RestaurantSeeder.SeedCountries(); var bo = new StaffRecordBusinessObject(); var resList = bo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); item.BeginDate = DateTime.Parse("2020/06/05"); var resUpdate = bo.UpdateAsync(item).Result; resList = bo.ListUnDeletedAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().BeginDate == DateTime.Parse("2020/06/05")); }
public void TestUpdateStaffRecordAsync() { RestaurantSeeder.Seed(); var bo = new StaffRecordBusinessObject(); var resList = bo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); var now = DateTime.Now; item.BeginDate = now; var resUpdate = bo.UpdateAsync(item).Result; resList = bo.ListNonDeletedAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().BeginDate == now); }
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); }
public void TestUpdateStaffRecordAsync() { 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.UpdateAsync(item).Result; resList = srbo.ListAsync().Result; 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 ); }