Exemple #1
0
        public void GetUserHistoryCountByUserId_InvalidArgument(int userId)
        {
            // Arrange
            SOVAContext           databaseContext       = new SOVAContext(_connectionString);
            UserHistoryRepository userHistoryRepository = new UserHistoryRepository(databaseContext);

            // Act
            int count = userHistoryRepository.NoOfUserHistory(userId);

            // Assert
            Assert.Equal(0, count);
        }
Exemple #2
0
        public void GetUserHistoryCountByUserId_ValidArgument()
        {
            // Arrange
            SOVAContext           databaseContext       = new SOVAContext(_connectionString);
            UserHistoryRepository userHistoryRepository = new UserHistoryRepository(databaseContext);

            User testUser = EnsureTestUserExistsThroughContext_ReturnsTestUser();

            // Act
            int count = userHistoryRepository.NoOfUserHistory(testUser.Id);

            // Assert
            Assert.True(count > -1);
        }
Exemple #3
0
        public void GetUserHistoryByUserId_IncludesHistory()
        {
            // Arrange
            SOVAContext           databaseContext       = new SOVAContext(_connectionString);
            UserHistoryRepository userHistoryRepository = new UserHistoryRepository(databaseContext);

            User testUser = EnsureTestUserExistsThroughContext_ReturnsTestUser();

            databaseContext.SearchResults.FromSqlRaw("SELECT * FROM best_match_weighted({0}, {1})", testUser.Id, "testing");

            // Act
            IEnumerable <UserHistory> histories = userHistoryRepository.GetUserHistoryByUserId(testUser.Id);

            // Assert
            Assert.All(histories, (history) => Assert.NotNull(history.History));
        }
 public UnitOfWork(DataContext context)
 {
     _context        = context;
     Account         = new AccountRepository(_context);
     AccountHistory  = new AccountHistoryRepository(_context);
     AccountType     = new AccountTypeRepository(_context);
     Business        = new BusinessRepository(_context);
     Client          = new ClientRepository(_context);
     Group           = new GroupRepository(_context);
     Relationship    = new RelationshipRepository(_context);
     Role            = new RoleRepository(_context);
     Transaction     = new TransactionRepository(_context);
     TransactionType = new TransactionTypeRepository(_context);
     User            = new UserRepository(_context);
     UserHistory     = new UserHistoryRepository(_context);
 }
Exemple #5
0
        public void GetUserHistoryByUserId_ValidArguments(int pageSize, int pageNumber)
        {
            // Arrange
            SOVAContext           databaseContext       = new SOVAContext(_connectionString);
            UserHistoryRepository userHistoryRepository = new UserHistoryRepository(databaseContext);

            User testUser = EnsureTestUserExistsThroughContext_ReturnsTestUser();

            databaseContext.SearchResults.FromSqlRaw("SELECT * from best_match_weighted({0}, {1})", testUser.Id, "testing");

            IEnumerable <UserHistory> expectedHistories = databaseContext.UserHistory
                                                          .Where(userHistory => userHistory.UserId == testUser.Id);

            // Act
            IEnumerable <UserHistory> actualHistories = userHistoryRepository.GetUserHistoryByUserId(testUser.Id);

            // Assert
            Assert.Equal(expectedHistories, actualHistories);
        }
 public UnitOfWork(DataContext context)
 {
     _context              = context;
     Account               = new AccountRepository(_context);
     AccountHistory        = new AccountHistoryRepository(_context);
     AccountType           = new AccountTypeRepository(_context);
     Business              = new BusinessRepository(_context);
     Client                = new ClientRepository(_context);
     Group                 = new GroupRepository(_context);
     Relationship          = new RelationshipRepository(_context);
     Role                  = new RoleRepository(_context);
     Transaction           = new TransactionRepository(_context);
     TransactionCode       = new TransactionCodeRepository(_context);
     TransactionType       = new TransactionTypeRepository(_context);
     TransactionTypeDetail = new TransactionTypeDetailRepository(_context);
     User                  = new UserRepository(_context);
     UserHistory           = new UserHistoryRepository(_context);
     UserActivity          = new UserActivityRepository(_context);
     Menu                  = new MenuRepository(_context);
     Control               = new ControlRepository(_context);
     Image                 = new ImageRepository(_context);
 }
 public UserHistoryController(IConfiguration configuration)
 {
     _uhRepository   = new UserHistoryRepository(configuration);
     _userRepository = new UserRepository(configuration);
 }