public void GetByIdNonExistingIdThrowsBussinesException() { using (var dbContext = GetContext()) { using (var facilityManagement = new FacilityManagement(dbContext, TestHelper.GetGenericPrincipalAdmin(), mapper)) { Assert.Throws <BussinesException>(() => facilityManagement.GetById(int.MaxValue)); } } }
public void DeleteFacilityWithReservationsPerformsLogicalDeletion() { var user = new User { Address = "Address", Email = "*****@*****.**", Name = "Name", UserName = "******", MiddleName = "Middle" }; var facility = new Facility { Name = "Test" }; var reservation = new Reservation { CreationdDate = DateTime.Now, CreatedBy = "Test", Ends = new TimeSpan(20, 0, 0), ReservationDate = DateTime.Now, Starts = new TimeSpan(19, 0, 0), UpdatedBy = "Test", UpdatedDate = DateTime.Now, User = user, Facility = facility }; facilities.Add(facility); reservations.Add(reservation); using (var dbContext = GetContext()) { using (var facilityManagement = new FacilityManagement(dbContext, TestHelper.GetGenericPrincipalAdmin(), mapper)) { facilityManagement.Delete(facility.Id); facility = facilityManagement.GetById(facility.Id); Assert.False(facility.IsActive); } } }