Exemple #1
0
        public void AddTime_AllTimeTypes_Successfully()
        {
            var extraTime = 50.5f;
            var extraTimeInMilliseconds = TimeSpan.FromSeconds(extraTime).TotalMilliseconds;
            var dateTime  = _timeService.DateTimeUtcNow;
            var unityTime = _timeService.UnityTimeNow;
            var unixTime  = _timeService.UnixTimeNow;

            _timeService.AddTime(extraTime);

            Assert.LessOrEqual(0, _timeService.DateTimeUtcNow.CompareTo(dateTime.AddSeconds(extraTime)));
            Assert.GreaterOrEqual(_timeService.UnityTimeNow, unityTime + extraTime);
            Assert.GreaterOrEqual(_timeService.UnixTimeNow, unixTime - extraTimeInMilliseconds);
        }
 public TimeReturnValue AddTime(HostSecurityToken oHostSecurityToken, Time time, TimeAdditionalDetail additionalTime, bool postToAccounts)
 {
     TimeReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oTimeService = new TimeService();
         returnValue = oTimeService.AddTime(Functions.GetLogonIdFromToken(oHostSecurityToken), time, additionalTime, postToAccounts);
     }
     else
     {
         returnValue = new TimeReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
        public TimeReturnValue AddTime(HostSecurityToken oHostSecurityToken, Time time, TimeAdditionalDetail additionalTime, bool postToAccounts)
        {
            TimeReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oTimeService = new TimeService();
                returnValue  = oTimeService.AddTime(Functions.GetLogonIdFromToken(oHostSecurityToken), time, additionalTime, postToAccounts);
            }
            else
            {
                returnValue         = new TimeReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }