private CVCreationRequestModel GetCorrectCVCreationRequestModel()
        {
            CVCreationRequestModel cv = new CVCreationRequestModel
            {
                User = new UserCreationServiceModel()
                {
                    FirstName  = "timur",
                    SecondName = "mirzaiev",
                    Email      = "*****@*****.**",
                    Phone      = "1234512345"
                },
                Educations = new Collection <EducationWithDetailsServiceModel>()
                {
                    new EducationWithDetailsServiceModel()
                    {
                        DegreeId = new Guid("a76428b1-aac5-410b-af4f-811c9b474997")
                    }
                },
                QualificationId = new Guid("a76428b1-aac5-410b-af4f-811c9b474997"),
                TechnologyId    = new Guid("f43f4b05-6cb1-4c72-9ebb-1fe5fd1fc62e"),
                SkillKnowledges = new Collection <SkillKnowledgeServiceModel>()
                {
                    new SkillKnowledgeServiceModel()
                    {
                        ExperienceId     = new Guid("561d468e-a93b-4e6b-a576-52b3d7bbf32a"),
                        KnowledgeLevelId = new Guid("2cb573c8-c593-445a-a1ca-d072fba8b47e"),
                        SkillId          = new Guid("980a6b85-b828-4553-92bb-410531539036")
                    }
                }
            };

            return(cv);
        }
예제 #2
0
        public async Task <IActionResult> Put(CVCreationRequestModel cv)
        {
            if (cv == null)
            {
                return(BadRequest());
            }

            var cvServiceModel = _mapper.Map <CVCreationRequestModel, CVCreationServiceModel>(cv);
            await _cvService.UpdateAsync(cvServiceModel);

            return(Ok());
        }
예제 #3
0
        public async Task <IActionResult> Post(CVCreationRequestModel cv)
        {
            if (cv == null)
            {
                BadRequest();
            }

            var cvServiceModel = _mapper.Map <CVCreationRequestModel, CVCreationServiceModel>(cv);
            var createdCV      = await _cvService.AddAsync(cvServiceModel);

            CreatedResult result = new CreatedResult("CreatedCV", createdCV);

            return(result);
            //return CreatedAtRoute("GetCVSummary", new { id = createdCV.Id }, createdCV);
        }
        public async Task PostCV_SuccessStatusCode()
        {
            CVCreationRequestModel cv = GetCorrectCVCreationRequestModel();
            // Arrange
            var request = new
            {
                Url  = "api/CV",
                Body = cv
            };
            // Act
            var response = await _client.PostAsync(request.Url, ContentHelper.GetStringContent(request.Body));

            // Assert
            response.EnsureSuccessStatusCode();
        }
        private CVCreationRequestModel GetCVCreationRequestModelExtended()
        {
            CVCreationRequestModel cv = new CVCreationRequestModel
            {
                Summary        = "summarytest",
                JobExperiences = new List <JobExperienceServiceModel>()
                {
                    new JobExperienceServiceModel()
                    {
                        CompanyName = "Apriorit",
                        ProjectName = "projectnametest",
                        Description = "testdescription",
                        StartDate   = DateTime.Parse("2018-02-13"),
                        FinishDate  = DateTime.Parse("2020-02-13")
                    }
                },
                User = new UserCreationServiceModel()
                {
                    FirstName  = "FN",
                    SecondName = "LN",
                    Email      = "*****@*****.**"
                },
                Educations = new Collection <EducationWithDetailsServiceModel>()
                {
                    new EducationWithDetailsServiceModel()
                    {
                        DegreeId   = new Guid("07a37911-a33e-4248-b8e3-02495f3030d4"),
                        PlaceName  = "DNU",
                        Speciality = "Software Engineering",
                        DateStart  = DateTime.Parse("2017-01-13"),
                        DateEnd    = DateTime.Parse("2020-02-13")
                    }
                },
                QualificationId = new Guid("e2e061e1-201e-41f8-8fb8-1106b00f5ae7"),
                TechnologyId    = new Guid("f43f4b05-6cb1-4c72-9ebb-1fe5fd1fc62e"),
                SkillKnowledges = new Collection <SkillKnowledgeServiceModel>()
                {
                    new SkillKnowledgeServiceModel()
                    {
                        ExperienceId     = new Guid("561d468e-a93b-4e6b-a576-52b3d7bbf32a"),
                        KnowledgeLevelId = new Guid("2cb573c8-c593-445a-a1ca-d072fba8b47e"),
                        SkillId          = new Guid("980a6b85-b828-4553-92bb-410531539036")
                    }
                }
            };

            return(cv);
        }
        public async Task PostCV_InCorrectEmail_BadRequest()
        {
            // Arrange
            CVCreationRequestModel cv = GetCorrectCVCreationRequestModel();

            cv.User.Email = "aaaaaamail.ru";
            var request = new
            {
                Url  = "api/CV",
                Body = cv
            };
            // Act
            var response = await _client.PostAsync(request.Url, ContentHelper.GetStringContent(request.Body));

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

            // Assert
            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.Contains("Email is required", value);
        }
        public async Task PostCV_CheckData()
        {
            CVCreationRequestModel cv = GetCVCreationRequestModelExtended();
            // Arrange
            var request = new
            {
                Url  = "api/CV",
                Body = cv
            };
            // Act
            var response = await _client.PostAsync(request.Url, ContentHelper.GetStringContent(request.Body));

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

            // Assert
            var            actual   = JsonConvert.DeserializeObject <CVServiceModel>(responseBody);
            CVServiceModel expected = GetCVCreatedModelExtended();

            Assert.Equal <CVServiceModel>(expected, actual, new CVServiceModelEqualityComparer());
        }
        public async Task PostCV_EmailIsNull_PhoneIsNull_BadRequest()
        {
            // Arrange
            CVCreationRequestModel cv = GetCorrectCVCreationRequestModel();

            cv.User.Email = null;
            cv.User.Phone = null;
            var request = new
            {
                Url  = "api/CV",
                Body = cv
            };
            // Act
            var response = await _client.PostAsync(request.Url, ContentHelper.GetStringContent(request.Body));

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

            // Assert
            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }