public async Task Save_Canditate_Success() { //Arrange using (var context = new AppDbContext(_options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); SetupSkills(context); var repo = new CandidateRepository(context); var candidate = new Candidate { FirstName = "Tom", LastName = "Liu", }; var skillIds = new List <int> { 1, 3 }; //Act await repo.SaveCandidateAsync(candidate, skillIds); var actual = repo.CandidateCount(); //Assert Assert.Equal(1, actual.Result); context.Database.EnsureDeleted(); } }
public async Task SetUp_Database_Success() { using (var context = new AppDbContext(_options)) { //Arrange context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var repo = new CandidateRepository(context); //Act var actual = await repo.CandidateCount(); //Assert Assert.Equal(0, actual); context.Database.EnsureDeleted(); } }