Example #1
0
        public virtual async Task <JobHistory> Save(JobHistory jobHistory)
        {
            await _jobHistoryRepository.CreateOrUpdateAsync(jobHistory);

            await _jobHistoryRepository.SaveChangesAsync();

            return(jobHistory);
        }
        public async Task GetAllJobHistories()
        {
            // Initialize the database
            await _jobHistoryRepository.CreateOrUpdateAsync(_jobHistory);

            await _jobHistoryRepository.SaveChangesAsync();

            // Get all the jobHistoryList
            var response = await _client.GetAsync("/api/job-histories?sort=id,desc");

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

            var json = JToken.Parse(await response.Content.ReadAsStringAsync());

            json.SelectTokens("$.[*].id").Should().Contain(_jobHistory.Id);
            json.SelectTokens("$.[*].startDate").Should().Contain(DefaultStartDate);
            json.SelectTokens("$.[*].endDate").Should().Contain(DefaultEndDate);
            json.SelectTokens("$.[*].language").Should().Contain(DefaultLanguage.ToString());
        }