public async void Create() { Mock <ILogger <JobCandidateRepository> > loggerMoc = JobCandidateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = JobCandidateRepositoryMoc.GetContext(); var repository = new JobCandidateRepository(loggerMoc.Object, context); var entity = new JobCandidate(); await repository.Create(entity); var record = await context.Set <JobCandidate>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Get() { Mock <ILogger <JobCandidateRepository> > loggerMoc = JobCandidateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = JobCandidateRepositoryMoc.GetContext(); var repository = new JobCandidateRepository(loggerMoc.Object, context); JobCandidate entity = new JobCandidate(); context.Set <JobCandidate>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.JobCandidateID); record.Should().NotBeNull(); }
public async void Delete() { Mock <ILogger <JobCandidateRepository> > loggerMoc = JobCandidateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = JobCandidateRepositoryMoc.GetContext(); var repository = new JobCandidateRepository(loggerMoc.Object, context); JobCandidate entity = new JobCandidate(); context.Set <JobCandidate>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.JobCandidateID); JobCandidate modifiedRecord = await context.Set <JobCandidate>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void Update_Entity_Is_Not_Tracked() { Mock <ILogger <JobCandidateRepository> > loggerMoc = JobCandidateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = JobCandidateRepositoryMoc.GetContext(); var repository = new JobCandidateRepository(loggerMoc.Object, context); JobCandidate entity = new JobCandidate(); context.Set <JobCandidate>().Add(entity); await context.SaveChangesAsync(); await repository.Update(new JobCandidate()); var modifiedRecord = context.Set <JobCandidate>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }