예제 #1
0
        public async Task GetApplicant_All()
        {
            using AppDbContext context = new AppDbContext(GetDbContextOptions());
            context.Applicants.RemoveRange(context.Applicants);
            context.SaveChanges();
            IApplicantDomainService service = GetService <IApplicantDomainService>();
            var applicant = new Applicant {
                Name = "Ali_1", FamilyName = "Hosseini", Address = "Address test", Age = 35, CountryOfOrigin = "Aruba", EMailAddress = "*****@*****.**"
            };
            var result1 = await service.CreateAsync(applicant);

            var applicant2 = new Applicant {
                Name = "Ali_1", FamilyName = "Hosseini", Address = "Address test", Age = 35, CountryOfOrigin = "Aruba", EMailAddress = "*****@*****.**"
            };
            var result2 = await service.CreateAsync(applicant2);

            var applicants = service.GetAll().Where(x => x.ID == result1.ID || x.ID == result2.ID).ToList();

            Assert.Equal(2, applicants.Count);
        }
예제 #2
0
 public async Task <ActionResult <IEnumerable <Applicant> > > GetApplicants()
 {
     return(await _service.GetAll().ToListAsync());
 }