Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public virtual async Task <Department> Save(Department department)
        {
            await _departmentRepository.CreateOrUpdateAsync(department);

            await _departmentRepository.SaveChangesAsync();

            return(department);
        }