public bool DeleteFacility(int id) { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.DeleteFacility(id)); } }
public List <FacilitySummaryChart> GetFacilitySummaries() { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.GetFacilitySummaries()); } }
public Facility SaveFacility(string step, Facility facility) { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.SaveFacility(step, facility)); } }
public List <DashboardWedge> GetDashboardWedges() { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.GetDashboardWedges()); } }
public List <MapCoordinate> GetMapCoordinates() { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.GetMapCoordinates()); } }
public List <Facility> GetAssetRegisterFacilities() { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.GetAssetRegisterFacilities()); } }
public bool UpdateFacility(Facility facility) { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.UpdateFacility(facility)); } }
public List <Facility> GetProperties(string userDepartment) { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.GetProperties(userDepartment)); } }
public Facility GetFacilityById(int id, FacilityTypes facilityType) { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.GetFacilityById(id, facilityType)); } }
public List <FacilityType> GetFacilityZonings() { using (var _facilityRepository = new FacilityRepository(_appSettings)) { return(_facilityRepository.GetFacilityZonings()); } }
public void Get_ReturnItem(int id) { var repository = new FacilityRepository(_dbContext, _cache.Object, _logger.Object); var item = repository.Get(id); Assert.NotNull(item); Assert.Equal(id, item.Id); }
public UserController(DatabaseContext context) { DbContext = context; UserRep = new UserRepository(context); PlaceRep = new PlaceRepository(context); WorkRep = new WorkRepository(context); FacilityRep = new FacilityRepository(context); }
public void Get_IncludeProperties_ReturnItem(int id) { var repository = new FacilityRepository(_dbContext, _cache.Object, _logger.Object); var item = repository.Get(id); Assert.NotNull(item); Assert.NotNull(item.Site); }
public void Filter(string nameFilter) { var repository = new FacilityRepository(_dbContext, _cache.Object, _logger.Object); var pagedItems = repository.Filter(1, 20, new OrderBySelector <Facility, string>(OrderByType.Ascending, f => f.Name), f => f.Name.Contains(nameFilter)); Assert.NotEmpty(pagedItems.Items); Assert.True(pagedItems.Items.TrueForAll(f => f.Name.Contains(nameFilter))); }
public void DeleteFacility(Facility facility) { // Сначала мы находим адрес, затем его удаляем Address address = AddressService.GetAddress(facility.Id); AddressService.DeleteAddress(address); AddressService.SaveAddress(); // После этого удаляем сам объект FacilityRepository.Delete(facility); }
public void Delete(int id) { var repository = new FacilityRepository(_dbContext, _cache.Object, _logger.Object); repository.Delete(id); var testedItem = _dbContext.Facilities.Find(id); Assert.Null(testedItem); }
public bool UpdateFacility(string step, Facility facility) { bool isUpdated = false; using (var _facilityRepository = new FacilityRepository(_appSettings)) { _facilityRepository.UpdateFacility(step, facility); isUpdated = true; } return(isUpdated); }
public void GetAllFacilities_should_return_three_results() { // Arrange var facilityRepository = new FacilityRepository(activeSessionManager); // Act var facilities = facilityRepository.GetAll(); // Assert Assert.That(facilities.Count, Is.EqualTo(3)); }
public FacilityController(DatabaseContext context) { DbContext = context; UserRep = new UserRepository(context); PlaceRep = new PlaceRepository(context); WorkRep = new WorkRepository(context); FacilityRep = new FacilityRepository(context); DiseaseRep = new DiseaseRepository(context); ScheduleRep = new ScheduleRepository(context); CheckoutRep = new CheckoutRepository(context); }
public ScheduleController() { //Let's be sure that every repo is using the same DbContext repo = new ScheduleRepository(context); doctorFacilityRepo = new DoctorFacilityRepository(context); doctorRepo = new DoctorRepository(context); facilityRepo = new FacilityRepository(context); doctorServiceRepo = new ForeignDoctorServiceRepository(context); client = new DpApi(AppSettings.ClientId, AppSettings.ClientSecret, (Locale)AppSettings.Locale); scheduleManager = new ScheduleManager(context, client); }
public void GetFacility_returns_proper_facility() { // Arrange var facilityRepository = new FacilityRepository(activeSessionManager); // Act var facility = facilityRepository.GetById(1); // Assert Assert.That(facility.Name, Is.EqualTo("Baymont Inn")); Assert.That(facility.Description, Is.EqualTo("Baymont is a great location")); }
public async void AddAsync_AddsToConext() { var facility = FacilityGenerator.Create(); using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); var repository = new FacilityRepository(context); await repository.AddAsync(facility); Assert.Equal(1, await context.Facility.CountAsync()); Assert.Equal(facility, await context.Facility.SingleAsync()); } }
public void Update(int id) { var updatedItem = _dbContext.Facilities.Find(id); updatedItem.Name += " (edited)"; var repository = new FacilityRepository(_dbContext, _cache.Object, _logger.Object); repository.Update(updatedItem); var testedItem = _dbContext.Facilities.Find(id); Assert.Equal(updatedItem.Name, testedItem.Name); }
public void FacilityExists_ChecksById() { var facility = FacilityGenerator.Create(); using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Facility.Add(facility); context.SaveChanges(); var repository = new FacilityRepository(context); Assert.True(repository.FacilityExists(facility.FacilityId)); Assert.False(repository.FacilityExists(-1)); Console.WriteLine(facility.FacilityId); } }
public void AddRelationTest() { var organizationFacilityRepository = new OrganizationFacilityRepository(context); var organizationFacility = new OrganizationFacility(); var organizationId = new OrganizationRepository(context).GetAll().OrderByDescending(x => x.Id).FirstOrDefault().Id; var facilityId = new FacilityRepository(context).GetAll().OrderByDescending(x => x.Id).FirstOrDefault().Id; var relation = true; var createdBy = "1234"; var result = organizationFacilityRepository.AddRelationAsync(organizationId, facilityId, relation, createdBy).Result; Assert.AreEqual(true, result); }
public async void DeleteAsync_RemovesFromContext() { var facility = FacilityGenerator.Create(); using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Facility.Add(facility); context.SaveChanges(); Assert.Equal(1, await context.Facility.CountAsync()); var repository = new FacilityRepository(context); await repository.DeleteAsync(facility); Assert.Equal(0, await context.Facility.CountAsync()); } }
public UnitOfWork(ICCEntities _context) { context = _context; UserAcount = new UserAcountRepository(_context); UserRole = new UserRoleRepository(_context); Role = new RoleRepository(_context); OrderItem = new OrderItemRepository(_context); Membership = new MembershipRepository(_context); Machine = new MachineRepository(_context); Item = new ItemRepository(_context); Facility = new FacilityRepository(_context); BuyFacility = new BuyFacilityRepository(_context); BookMachine = new BookMachineRepository(_context); // UserAcounts = new UserAcountRepository(userAcount); }
public void Create(int newId) { var newItem = new Facility { Id = newId, Name = $"Facility {newId}" }; var repository = new FacilityRepository(_dbContext, _cache.Object, _logger.Object); var returnId = repository.Create(newItem); var item = _dbContext.Facilities.Find(returnId); Assert.Equal(newId, returnId); Assert.NotNull(item); Assert.Equal(newItem.Name, item.Name); }
public async void UpdateAsync_UpdatesInContext() { var facility = FacilityGenerator.Create(); using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Facility.Add(facility); context.SaveChanges(); var repository = new FacilityRepository(context); var newFacility = await repository.GetByIdAsync(facility.FacilityId); newFacility.FacilityName = "Court 1"; newFacility.SportId = 2; Assert.Equal(1, await context.Facility.CountAsync()); Assert.Equal(newFacility, await context.Facility.SingleAsync()); } }
public async void GetByIdAsync_ReturnsCorrectItems() { var list = FacilityGenerator.CreateList(5); var expected = list[2]; using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Facility.AddRange(list); context.SaveChanges(); Assert.Equal(list.Count, await context.Facility.CountAsync()); var repository = new FacilityRepository(context); var facility = await repository.GetByIdAsync(expected.FacilityId); Assert.IsType <Facility>(facility); Assert.Equal(expected, facility); } }
public async void GetAllAsync_ReturnsAllFromContext() { var expectedFacilitys = FacilityGenerator.CreateList(); using (var context = new booking_facilitiesContext(contextOptions)) { context.Database.EnsureCreated(); context.Facility.AddRange(expectedFacilitys); context.SaveChanges(); Assert.Equal(expectedFacilitys.Count, await context.Facility.CountAsync()); var repository = new FacilityRepository(context); var resources = repository.GetAllAsync(); Assert.IsAssignableFrom <IQueryable <Facility> >(resources); Assert.Equal(expectedFacilitys, resources); } }
public List <facility> GetAllFacilities() { return(FacilityRepository.FindBy(p => p.status == 1).Include(p => p.facility_content).ToList()); }