Exemplo n.º 1
0
        public virtual async Task <IPage <Sazeman> > FindAll(IPageable pageable)
        {
            var page = await _sazemanRepository.QueryHelper()
                       .GetPageAsync(pageable);

            return(page);
        }
Exemplo n.º 2
0
        public async Task UpdateSazeman()
        {
            // Initialize the database
            await _sazemanRepository.CreateOrUpdateAsync(_sazeman);

            await _sazemanRepository.SaveChangesAsync();

            var databaseSizeBeforeUpdate = await _sazemanRepository.CountAsync();

            // Update the sazeman
            var updatedSazeman = await _sazemanRepository.QueryHelper().GetOneAsync(it => it.Id == _sazeman.Id);

            // Disconnect from session so that the updates on updatedSazeman are not directly saved in db
//TODO detach
            updatedSazeman.SazemanName = UpdatedSazemanName;

            SazemanDto updatedSazemanDto = _mapper.Map <SazemanDto>(_sazeman);
            var        response          = await _client.PutAsync("/api/sazemen", TestUtil.ToJsonContent(updatedSazemanDto));

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

            // Validate the Sazeman in the database
            var sazemanList = await _sazemanRepository.GetAllAsync();

            sazemanList.Count().Should().Be(databaseSizeBeforeUpdate);
            var testSazeman = sazemanList.Last();

            testSazeman.SazemanName.Should().Be(UpdatedSazemanName);
        }