public async Task AddEducation_ToNonExistingResume_ReturnsFalse() { var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var model = new Resume() { JobSeeker = new JobSeeker() { FirstName = "JobSeekerName1", LastName = "JobSeekerName2", User = new User() { UserName = "******" } } }; var serviceModel = new EducationServiceModel(); var educationsService = new EducationsService(new EfRepository <Education>(context), new EfRepository <Resume>(context)); var result = await educationsService.AddEducation(model.Id, serviceModel); Assert.False(result); }
public async Task AddEducation_WithValidData_ToExistingResume_WorksCorrectly() { var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var model = new Resume() { JobSeeker = new JobSeeker() { FirstName = "JobSeekerName1", LastName = "JobSeekerName2", User = new User() { UserName = "******" } } }; await context.AddAsync(model); context.SaveChanges(); var serviceModel = new EducationServiceModel() { Major = "MajorTest", Institute = "InstituteTest", From = 2000, To = 2001, }; var educationsService = new EducationsService(new EfRepository <Education>(context), new EfRepository <Resume>(context)); var result = await educationsService.AddEducation(model.Id, serviceModel); Assert.True(result); }