public async Task GetAllDepartments() { // Initialize the database await _departmentRepository.CreateOrUpdateAsync(_department); await _departmentRepository.SaveChangesAsync(); // Get all the departmentList var response = await _client.GetAsync("/api/departments?sort=id,desc"); response.StatusCode.Should().Be(HttpStatusCode.OK); var json = JToken.Parse(await response.Content.ReadAsStringAsync()); json.SelectTokens("$.[*].id").Should().Contain(_department.Id); json.SelectTokens("$.[*].departmentName").Should().Contain(DefaultDepartmentName); }
public virtual async Task <Department> Save(Department department) { await _departmentRepository.CreateOrUpdateAsync(department); await _departmentRepository.SaveChangesAsync(); return(department); }