Beispiel #1
0
        public void SortByNumberOfSessions()
        {
            DateTime          now   = DateTime.Now;
            AmplaAuditSession one   = new AmplaAuditSession("One", now);
            AmplaAuditSession two   = new AmplaAuditSession("Two", now);
            AmplaAuditSession three = new AmplaAuditSession("Three", now);

            one.Fields.Add(new AmplaAuditField());
            two.Fields.Add(new AmplaAuditField());
            two.Fields.Add(new AmplaAuditField());
            three.Fields.Add(new AmplaAuditField());
            three.Fields.Add(new AmplaAuditField());
            three.Fields.Add(new AmplaAuditField());


            List <AmplaAuditSession> list = new List <AmplaAuditSession> {
                two, one, three
            };

            list.Sort();

            Assert.That(list[0], Is.EqualTo(three));
            Assert.That(list[1], Is.EqualTo(two));
            Assert.That(list[2], Is.EqualTo(one));
        }
Beispiel #2
0
        public void SortByTime()
        {
            AmplaAuditSession now             = new AmplaAuditSession("User", DateTime.Now);
            AmplaAuditSession tomorrow        = new AmplaAuditSession("User", DateTime.Today.AddDays(1));
            AmplaAuditSession nightBeforeLast = new AmplaAuditSession("User", DateTime.Today.AddDays(-1).AddHours(-1));

            List <AmplaAuditSession> list = new List <AmplaAuditSession> {
                tomorrow, nightBeforeLast, now
            };

            list.Sort();

            Assert.That(list[0], Is.EqualTo(nightBeforeLast));
            Assert.That(list[1], Is.EqualTo(now));
            Assert.That(list[2], Is.EqualTo(tomorrow));
        }
Beispiel #3
0
        public void SortByUser()
        {
            DateTime          now   = DateTime.Now;
            AmplaAuditSession one   = new AmplaAuditSession("One", now);
            AmplaAuditSession two   = new AmplaAuditSession("Two", now);
            AmplaAuditSession three = new AmplaAuditSession("Three", now);

            List <AmplaAuditSession> list = new List <AmplaAuditSession> {
                two, one, three
            };

            list.Sort();

            Assert.That(list[0], Is.EqualTo(one));
            Assert.That(list[1], Is.EqualTo(three));
            Assert.That(list[2], Is.EqualTo(two));
        }