public async Task TestGetThreadsForSpecifiedUser() { StudentifyAccountsRepository studentifyAccountsRepository = new StudentifyAccountsRepository(_context, new SelectRepositoryBase <StudentifyAccount>(_context), new UpdateRepositoryBase <StudentifyAccount>(_context), new InsertRepositoryBase <StudentifyAccount>(_context)); StudentifyUser user = new StudentifyUser { UserName = "******" }; StudentifyAccount account = new StudentifyAccount { StudentifyUserId = user.Id, User = user }; Thread insertedThread = new Thread() { ReferencedEventId = 1, ReferencedEvent = new Info { Author = account }, UserAccount = account }; await studentifyAccountsRepository.Insert.One(account); await _repository.Insert.One(insertedThread); var threads = await _repository.SelectAllUserRelatedThreads(account.UserName); Assert.True(threads.Any()); }
public void Setup() { _dbContextOptions = new DbContextOptionsBuilder <StudentifyDbContext>() .UseInMemoryDatabase(databaseName: "StudentifyDb") .Options; _context = new StudentifyDbContext(_dbContextOptions); _repository = new StudentifyAccountsRepository(_context, new SelectRepositoryBase <StudentifyAccount>(_context), new UpdateRepositoryBase <StudentifyAccount>(_context), new InsertRepositoryBase <StudentifyAccount>(_context)); }