public async void VacancyCVFlow_Status()
        {
            VacancyCVFlowCreationRequestModel vacancyCVFlow = new VacancyCVFlowCreationRequestModel()
            {
                CVId      = new Guid("a6a7e31d-3db1-45b6-8172-3ad5556f65c1"),
                Notes     = "test",
                VacancyId = new Guid("623af0cf-21c1-4dc6-8f86-09601e9dba87")
            };

            // Arrange
            var postRequest = new
            {
                Url  = "api/VacancyCVFlow",
                Body = vacancyCVFlow
            };
            var statusRequest = new
            {
                Url            = "Status",
                cv             = vacancyCVFlow.CVId,
                vacancy        = vacancyCVFlow.VacancyId,
                expectedStatus = VacancyCVStatus.NotExists.ToString()
            };

            #region NotExists
            string url      = String.Format("{0}?CVId={1}&vacancyId={2}", statusRequest.Url, statusRequest.cv, statusRequest.vacancy);
            var    response = await _client.GetAsync(url);

            var responseBody = await response.Content.ReadAsStringAsync();

            // Assert
            Assert.Equal(statusRequest.expectedStatus, responseBody);
            #endregion

            #region post record
            // Act
            response = await _client.PostAsync(postRequest.Url, ContentHelper.GetStringContent(postRequest.Body));

            var value = await response.Content.ReadAsStringAsync();

            var stringResponse = await response.Content.ReadAsStringAsync();

            var beforeFlow = JsonConvert.DeserializeObject <VacancyCVFlow>(stringResponse);
            // Assert
            response.EnsureSuccessStatusCode();
            #endregion

            #region check Draft status
            url      = String.Format("{0}?CVId={1}&vacancyId={2}", statusRequest.Url, statusRequest.cv, statusRequest.vacancy);
            response = await _client.GetAsync(url);

            responseBody = await response.Content.ReadAsStringAsync();

            // Assert
            Assert.Equal(VacancyCVStatus.Draft.ToString(), responseBody);
            #endregion
        }
        private VacancyCVFlowCreationRequestModel GetCorrectVacancyCVFlowCreationRequestModel()
        {
            VacancyCVFlowCreationRequestModel vacancyCVFlow = new VacancyCVFlowCreationRequestModel()
            {
                CVId      = new Guid("a6a7e31d-3db1-45b6-8172-3ad5556f65ce"),
                Notes     = "test",
                VacancyId = new Guid("623af0cf-21c1-4dc6-8f86-09601e9dba86")
            };

            return(vacancyCVFlow);
        }
Пример #3
0
        public async Task <IActionResult> PostAsync([FromBody] VacancyCVFlowCreationRequestModel vacancyCVFlow)
        {
            if (vacancyCVFlow == null)
            {
                return(BadRequest());
            }

            VacancyCVFlowCreationServiceModel flow = _mapper.Map <VacancyCVFlowCreationRequestModel, VacancyCVFlowCreationServiceModel>(vacancyCVFlow);
            VacancyCVFlow addedFlow = await _vacancyCVFlowService.AddAsync(flow);

            return(CreatedAtRoute("GetVacancyCVFlow", new { id = addedFlow.Id }, addedFlow));
        }
        public async void VacancyCVFlow_Post_IsCorrect()
        {
            VacancyCVFlowCreationRequestModel vacancyCVFlow = GetCorrectVacancyCVFlowCreationRequestModel();
            // Arrange
            var request = new
            {
                Url  = "api/VacancyCVFlow",
                Body = vacancyCVFlow
            };
            // Act
            var response = await _client.PostAsync(request.Url, ContentHelper.GetStringContent(request.Body));

            var value = await response.Content.ReadAsStringAsync();

            // Assert
            response.EnsureSuccessStatusCode();
        }