Esempio n. 1
0
 public void GetHashCodeTest()
 {
     Assert.AreEqual(0, new TimerProcessorItem().GetHashCode());
     Assert.AreEqual(new TimerProcessorItem().GetHashCode(), new TimerProcessorItem().GetHashCode());
     Assert.AreNotEqual(TimerProcessorItem.Add <object>(DateTime.Now, TimeSpan.FromSeconds(1)),
                        TimerProcessorItem.Add <object>(DateTime.Now, TimeSpan.FromSeconds(1)));
 }
Esempio n. 2
0
        public void Initialized()
        {
            var aa = TimerProcessorItem.Add <object>(DateTime.Now, TimeSpan.Zero);
            var bb = TimerProcessorItem.Add <object>(DateTime.Now, TimeSpan.Zero);

            Assert.IsTrue(aa != bb);
        }
Esempio n. 3
0
        public void TryCancel()
        {
            var item = TimerProcessorItem.Add <object>(DateTime.Now, TimeSpan.FromSeconds(1));

            item.TryCancel();
            Assert.IsNotNull(item.Expired);
            Assert.IsTrue(item.Expired.Value);
        }
Esempio n. 4
0
        public void TrySetException2()
        {
            var item = TimerProcessorItem.Add <object>(DateTime.Now, TimeSpan.FromSeconds(1));

            item.TrySetException(new Exception("ex"));
            Assert.IsNotNull(item.Expired);
            Assert.IsTrue(item.Expired.Value);
        }
Esempio n. 5
0
        public void Equals()
        {
            object aa = TimerProcessorItem.Add <object>(DateTime.Now, TimeSpan.Zero);

            // ReSharper disable EqualExpressionComparison
            Assert.IsTrue(aa.Equals(aa));
            // ReSharper restore EqualExpressionComparison
        }