예제 #1
0
 public async Task <DataWithCount <ICollection <Location> > > GetPaginatedLocationsListAsync(
     BaseFilter filter)
 {
     VerifyPermission(Permission.ManageLocations);
     filter.SiteId = GetCurrentSiteId();
     return(new DataWithCount <ICollection <Location> >
     {
         Data = await _locationRepository.PageAsync(filter),
         Count = await _locationRepository.CountAsync(filter)
     });
 }
예제 #2
0
        public async Task CreateLocation()
        {
            var databaseSizeBeforeCreate = await _locationRepository.CountAsync();

            // Create the Location
            var response = await _client.PostAsync("/api/locations", TestUtil.ToJsonContent(_location));

            response.StatusCode.Should().Be(HttpStatusCode.Created);

            // Validate the Location in the database
            var locationList = await _locationRepository.GetAllAsync();

            locationList.Count().Should().Be(databaseSizeBeforeCreate + 1);
            var testLocation = locationList.Last();

            testLocation.StreetAddress.Should().Be(DefaultStreetAddress);
            testLocation.PostalCode.Should().Be(DefaultPostalCode);
            testLocation.City.Should().Be(DefaultCity);
            testLocation.StateProvince.Should().Be(DefaultStateProvince);
        }