public void Test_Account_Repository_Exists_Record_Not_Exists() { //setup DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("test1"); var context = new ApplicationDbContext(optionsBuilder.Options); IAccountRepositoryV9 repository = new AccountRepositoryV9(context); //act bool exists = repository.Exists("testing"); exists.Should().BeFalse(); }
public async void Test_Account_Repository_Find_Record_Not_Exists() { //setup DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("test1"); var context = new ApplicationDbContext(optionsBuilder.Options); IAccountRepositoryV9 repository = new AccountRepositoryV9(context); //act Account record = await repository.Find(1); //verify record.Should().BeNull(); }
public void Test_Account_Repository_Create() { //setup DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("test1"); var context = new ApplicationDbContext(optionsBuilder.Options); IAccountRepositoryV9 repository = new AccountRepositoryV9(context); //act repository.Create(new Account()); //verify context.Accounts.Count().Should().Be(1); }
public async void Test_Account_Repository_Find_Record_Exists() { //setup DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("test1"); var context = new ApplicationDbContext(optionsBuilder.Options); IAccountRepositoryV9 repository = new AccountRepositoryV9(context); context.Accounts.Add(new Account(1, default(string), default(string), default(DateTime), default(string))); context.SaveChanges(); //act Account record = await repository.Find(1); //verify record.Should().NotBeNull(); }
public void Test_Account_Repository_Exists_Record_Exists() { //setup DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase("test1"); var context = new ApplicationDbContext(optionsBuilder.Options); IAccountRepositoryV9 repository = new AccountRepositoryV9(context); context.Accounts.Add(new Account(default(int), "test", default(string), default(DateTime), default(string))); context.SaveChanges(); //act bool exists = repository.Exists("test"); //verify exists.Should().BeTrue(); }