Example #1
0
 public void GetAndRecordTest()
 {
     Assert.AreEqual(0, _repository.GetUserAccessCount(Username, new TimeSpan(999, 0, 0)));
     for (int i = 0; i < 999; i++)
     {
         _repository.RecordAccess(Username, "", "");
         Assert.AreEqual(i + 1, _repository.GetUserAccessCount(Username, new TimeSpan(999, 0, 0)));
     }
 }
        public bool TryAccess(string username, EanEicCode code)
        {
            int accessCount = _userAccessRepository.GetUserAccessCount(username, _timeWindow);

//            _userAccessRepository.RecordAccess(username, code);

            return(accessCount < _maxAccessCount);
        }