Example #1
0
        public void ToUnixTimeTest()
        {
            DateTime expected  = DateTime.Now;
            long     timeStamp = DateHelper.ToUnixTime(expected);
            DateTime actual    = DateHelper.FromUnixTime(timeStamp);

            CommonComparers.AreSimilar(expected, actual);
        }
        public void AscendingSortedGuid_LexicalOrdering_Ascending_WithSuccess()
        {
            var timestamp = DateTimeOffset.UtcNow;
            List <AscendingSortedGuid> expected = new List <AscendingSortedGuid>
            {
                new AscendingSortedGuid(timestamp, Guid.NewGuid()),
                new AscendingSortedGuid(timestamp.AddMilliseconds(10), Guid.NewGuid()),
                new AscendingSortedGuid(timestamp.AddMilliseconds(100), Guid.NewGuid()),
                new AscendingSortedGuid(timestamp.AddMilliseconds(1000), Guid.NewGuid()),
            };

            List <AscendingSortedGuid> actual = expected.OrderBy(x => x.ToString()).ToList();

            CommonComparers.AreCollectionEquals(expected, actual, AssertCompare);

            actual = expected.OrderBy(x => x).ToList();
            CommonComparers.AreCollectionEquals(expected, actual, AssertCompare);
        }
Example #3
0
        public void DescendingSortedGuid_Order_WithSuccess()
        {
            List <Fake <DescendingSortedGuid> > expected = new List <Fake <DescendingSortedGuid> >();

            for (int i = 0; i < 3; i++)
            {
                var item = NewItemDesc();
                expected.Add(item);
                Thread.Sleep(10); // slowing down
            }

            List <Fake <DescendingSortedGuid> > actual = new List <Fake <DescendingSortedGuid> >();

            actual = expected.OrderByDescending(x => x.Id.ToString()).ToList();
            CommonComparers.AreCollectionEquals(expected, actual, AssertCompare);

            actual = expected.OrderByDescending(x => x.Id).ToList();
            CommonComparers.AreCollectionEquals(expected, actual, AssertCompare);
        }