예제 #1
0
        public async Task <ActionResult <Applicant> > GetApplicant(int id)
        {
            var applicant = await _service.GetAsync(id);

            if (applicant == null)
            {
                _logger?.LogDebug($"GET - Applicant with ID:\"{id}\" not found!");
                return(NotFound());
            }

            return(applicant);
        }
예제 #2
0
        public async Task UpdateApplicant()
        {
            IApplicantDomainService service = GetService <IApplicantDomainService>();
            var applicant = new Applicant {
                Name = "Ali_1", FamilyName = "Hosseini", Address = "Address test", Age = 35, CountryOfOrigin = "Aruba", EMailAddress = "*****@*****.**"
            };
            await service.CreateAsync(applicant);

            var result = await service.GetAsync(applicant.ID);

            result.Name = "Ali_2";
            await service.UpdateAsync(result);

            var updatedResult = await service.GetAsync(applicant.ID);

            Assert.NotNull(updatedResult);
            Assert.Equal("Ali_2", result.Name);
        }
예제 #3
0
        public async Task DeleteApplicant()
        {
            IApplicantDomainService service = GetService <IApplicantDomainService>();
            var applicant = new Applicant {
                Name = "Ali_1", FamilyName = "Hosseini", Address = "Address test", Age = 35, CountryOfOrigin = "Aruba", EMailAddress = "*****@*****.**"
            };
            await service.CreateAsync(applicant);

            //Check Existence
            var result = await service.GetAsync(applicant.ID);

            Assert.NotNull(result);

            //Delete
            var updateState = await service.DeleteAsync(applicant.ID);

            Assert.True(updateState);

            //Check
            var deletedResult = await service.GetAsync(applicant.ID);

            Assert.Null(deletedResult);
        }
예제 #4
0
        public async Task CreateValidApplicantWithoutHired_CheckHired()
        {
            IApplicantDomainService service = GetService <IApplicantDomainService>();
            var applicant = new Applicant {
                Name = "Ali_1", FamilyName = "Hosseini", Address = "Address test", Age = 35, CountryOfOrigin = "Aruba", EMailAddress = "*****@*****.**"
            };
            var result = await service.CreateAsync(applicant);

            Assert.NotNull(result);
            Assert.NotEqual(0, result.ID);
            var resultData = service.GetAsync(1);

            Assert.NotNull(result);
            Assert.False(result.Hired);
        }