Aspectacular.Test.RetryAspectsTest.SimulateFailureFor C# (CSharp) Method

SimulateFailureFor() private method

Will be failing for a given period of time since test start.
private SimulateFailureFor ( uint millisec, bool throwExceptionOnFailure = true ) : object
millisec uint
throwExceptionOnFailure bool
return object
        private object SimulateFailureFor(uint millisec, bool throwExceptionOnFailure = true)
        {
            DateTime now = DateTime.UtcNow;

            uint elpased = (uint)(now - this.testStart.Value).TotalMilliseconds;

            if(elpased <= millisec)
            {
                if(throwExceptionOnFailure)
                    throw new Exception("Simulated time failure");

                return null;
            }

            return now;
        }