public void Test_Account_Repository_Exists_Record_Not_Exists() { DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("test1"); var context = new ApplicationDbContext(optionsBuilder.Options); IAccountRepositoryV5 repository = new AccountRepositoryV5(context); bool exists = repository.Exists("testing"); Assert.False(exists); }
public void Test_Account_Repository_Exists_Record_Exists() { DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("test1"); var context = new ApplicationDbContext(optionsBuilder.Options); IAccountRepositoryV5 repository = new AccountRepositoryV5(context); var account = new Account(); account.Name = "testing"; context.Accounts.Add(account); context.SaveChanges(); bool exists = repository.Exists("testing"); Assert.True(exists); }