public async Task InsertUserActionToDB(UserActionCreateDTO userAction) { // Map, add fields to customer entity UserAction userActionEntity = AMapper.Mapper.Map <UserActionCreateDTO, UserAction>(userAction); // Insert a customer into the database await UserActionRepository.Insert(userActionEntity); }
public async Task <IEnumerable <UserActionGetDetailDTO> > GetAllUserActions() { IEnumerable <UserAction> userActions = await UserActionRepository.GetAll(); var UserActionDTOs = AMapper.Mapper.Map <IEnumerable <UserAction>, IEnumerable <UserActionGetDetailDTO> >(userActions); return(UserActionDTOs); }
public ParticipantsController() { var connectionStr = Settings.GetStringDB(); this._participantsRepository = new ParticipantRepository(connectionStr); _userActionRepository = new UserActionRepository(connectionStr); ur = new UserRepository(connectionStr); }
public TranslationController() { var connectionString = Settings.GetStringDB(); translationRepository = new TranslationRepository(connectionString); userRepository = new UserRepository(connectionString); _userActionRepository = new UserActionRepository(connectionString); }
public GlossariesController(GlossariesService glossariesService) { _glossariesService = glossariesService; var connectionString = Settings.GetStringDB(); _userActionRepository = new UserActionRepository(connectionString); ur = new UserRepository(connectionString); }
public void removeUserActionInvalid() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid userID = new Guid(); string action = "View_Watchlist"; //Act => Assert Assert.ThrowsException <ArgumentNullException>(() => uaRepo.RemoveUserAction(userID, action)); }
public async Task <IEnumerable <UserActionGetDetailDTO> > GetUserActionsByDate(DateTime dateTime) { // convert date to string because SQLite doesn't have DateTime type string dateTimeStr = dateTime.Date.ToString(dateTimeFormat); // according to string format of dateTime in SQLite first part of dateTimeStr will be "yyyy-MM-dd" string dateStr = dateTimeStr.Split(' ')[0]; IEnumerable <UserAction> userActions = await UserActionRepository.GetByDate(dateStr); var UserActionDTOs = AMapper.Mapper.Map <IEnumerable <UserAction>, IEnumerable <UserActionGetDetailDTO> >(userActions); return(UserActionDTOs); }
public ProjectController() { string connectionString = Settings.GetStringDB(); _localizationProjectRepository = new LocalizationProjectRepository(connectionString); _localizationProjectsLocalesRepository = new LocalizationProjectsLocalesRepository(connectionString); _localeRepository = new LocaleRepository(connectionString); _userActionRepository = new UserActionRepository(connectionString); ur = new UserRepository(connectionString); _participantsRepository = new ParticipantRepository(connectionString); _roleRepository = new RoleRepository(connectionString); }
public void UserActionRepository_RemoveUserAction_InvalidUA() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid userID = new Guid(); string action = "View_Watchlist"; UserAction ua = new UserAction(userID, action); //Act => Assert Assert.ThrowsException <DbUpdateConcurrencyException>(() => uaRepo.RemoveUserAction(ua)); }
public void UserActionRepository_GetUsersByAction_NullAction() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); string action = ""; //Act List <User> ul = uaRepo.GetUsersByAction(action); //Assert Assert.AreEqual(ul.Count, 0); }
public void getUserActionsByUserIDNotNull() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid id = new Guid("7AF91B37-DC4A-E911-8259-0A64F53465D0"); //Act List <string> ua = uaRepo.GetActionsByUserID(id); //Assert Assert.AreEqual(ua.Count, 2); }
public void UserActionRepository_GetUserAction_ValidUA() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid userID = new Guid("44361F37-036B-E911-AA03-021598E9EC9E"); string action = "Login"; //Act UserAction ua = uaRepo.GetUserAction(userID, action); //Assert Assert.IsNotNull(ua); }
public void UserActionRepository_GetActionsByUserID_ValidUserID() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid id = new Guid("44361F37-036B-E911-AA03-021598E9EC9E"); //Act List <string> ua = uaRepo.GetActionsByUserID(id); //Assert Assert.AreEqual(ua.Count, 2); }
public void UserActionRepository_GetUserAction_InvalidUA() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid userID = new Guid("7CF91B37-DC4A-E911-8259-0A64F53465D0"); string action = "Search"; //Act UserAction ua = uaRepo.GetUserAction(userID, action); //Assert Assert.IsNull(ua); }
public void removeUserActionValid() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid userID = new Guid("7BF91B37-DC4A-E911-8259-0A64F53465D0"); string action = "View_Watchlist"; //Act uaRepo.RemoveUserAction(userID, action); UserAction removedUA = uaRepo.GetUserAction(userID, action); //Assert Assert.IsNull(removedUA); }
public void UserActionRepository_AddUserAction_ValidUser() { //Arrange DataBaseContext db = new DataBaseContext(); IUserActionRepository uaRepo = new UserActionRepository(db); Guid userID = new Guid("F98A70A1-056B-E911-AA03-021598E9EC9E"); string action = "View_Watchlist"; UserAction ua = new UserAction(userID, action); //Act uaRepo.AddUserAction(ua); UserAction newUA = uaRepo.GetUserAction(userID, action); //Assert Assert.IsNotNull(newUA); }
public void UserActionRepository_GetActionsByUserID_NullID() { //Arrange DataBaseContext db = new DataBaseContext(); using (DataBaseContext _db = new DataBaseContext()) { } IUserActionRepository uaRepo = new UserActionRepository(db); Guid id = new Guid(); //Act List <string> ua = uaRepo.GetActionsByUserID(id); //Assert Assert.AreEqual(ua.Count, 0); }
public UserActionsController(IDbContext dbContext) { _repository = new UserActionRepository(dbContext); }
public UserActionService(DataBaseContext db) { uaRepo = new UserActionRepository(db); }
public UserActionService() { UserActionRepository = new UserActionRepository(); AMapper = new AMapper(); }
public ProjectLocaleController() { _localizationProjectsLocalesRepository = new LocalizationProjectsLocalesRepository(Settings.GetStringDB()); _userActionRepository = new UserActionRepository(Settings.GetStringDB()); }