public void Sort()
 {
     NotificationFileCollection NFiles = new NotificationFileCollection();
       NFiles.Add(new NotificationFile("new-order-notification--123--1.xml", new DateTime(2006, 12, 10)));
       NFiles.Add(new NotificationFile("new-order-notification--123--2.xml", new DateTime(2006, 12, 9)));
       NFiles.Add(new NotificationFile("new-order-notification--123--3.xml", new DateTime(2006, 12, 11)));
       NFiles.SortByAge();
       NotificationFile NFile;
       NFile = NFiles.GetFileAt(0);
       Assert.AreEqual("new-order-notification--123--2.xml", NFile.Name);
       NFile = NFiles.GetFileAt(1);
       Assert.AreEqual("new-order-notification--123--1.xml", NFile.Name);
       NFile = NFiles.GetFileAt(2);
       Assert.AreEqual("new-order-notification--123--3.xml", NFile.Name);
 }
Ejemplo n.º 2
0
        public void Sort()
        {
            NotificationFileCollection NFiles = new NotificationFileCollection();

            NFiles.Add(new NotificationFile("new-order-notification--123--1.xml", new DateTime(2006, 12, 10)));
            NFiles.Add(new NotificationFile("new-order-notification--123--2.xml", new DateTime(2006, 12, 9)));
            NFiles.Add(new NotificationFile("new-order-notification--123--3.xml", new DateTime(2006, 12, 11)));
            NFiles.SortByAge();
            NotificationFile NFile;

            NFile = NFiles.GetFileAt(0);
            Assert.AreEqual("new-order-notification--123--2.xml", NFile.Name);
            NFile = NFiles.GetFileAt(1);
            Assert.AreEqual("new-order-notification--123--1.xml", NFile.Name);
            NFile = NFiles.GetFileAt(2);
            Assert.AreEqual("new-order-notification--123--3.xml", NFile.Name);
        }
 public void FilterOutNewFiles()
 {
     NotificationFileCollection NFiles = new NotificationFileCollection();
       DateTime TenSecondsAgo = DateTime.Now.Subtract(new TimeSpan(0, 0, 10));
       DateTime OneMinuteAgo = DateTime.Now.Subtract(new TimeSpan(0, 1, 0));
       DateTime TwoMinutesAgo = DateTime.Now.Subtract(new TimeSpan(0, 2, 0));
       NFiles.Add(new NotificationFile("new-order-notification--123--1.xml", TenSecondsAgo));
       NFiles.Add(new NotificationFile("new-order-notification--123--2.xml", OneMinuteAgo));
       NFiles.Add(new NotificationFile("new-order-notification--123--3.xml", TwoMinutesAgo));
       NFiles.RemoveNewFiles(30);
       Assert.AreEqual(2, NFiles.Count);
       NFiles.SortByAge();
       NotificationFile NFile;
       NFile = NFiles.GetFileAt(0);
       Assert.AreEqual("new-order-notification--123--3.xml", NFile.Name);
       NFile = NFiles.GetFileAt(1);
       Assert.AreEqual("new-order-notification--123--2.xml", NFile.Name);
 }
Ejemplo n.º 4
0
        public void FilterOutNewFiles()
        {
            NotificationFileCollection NFiles = new NotificationFileCollection();
            DateTime TenSecondsAgo            = DateTime.Now.Subtract(new TimeSpan(0, 0, 10));
            DateTime OneMinuteAgo             = DateTime.Now.Subtract(new TimeSpan(0, 1, 0));
            DateTime TwoMinutesAgo            = DateTime.Now.Subtract(new TimeSpan(0, 2, 0));

            NFiles.Add(new NotificationFile("new-order-notification--123--1.xml", TenSecondsAgo));
            NFiles.Add(new NotificationFile("new-order-notification--123--2.xml", OneMinuteAgo));
            NFiles.Add(new NotificationFile("new-order-notification--123--3.xml", TwoMinutesAgo));
            NFiles.RemoveNewFiles(30);
            Assert.AreEqual(2, NFiles.Count);
            NFiles.SortByAge();
            NotificationFile NFile;

            NFile = NFiles.GetFileAt(0);
            Assert.AreEqual("new-order-notification--123--3.xml", NFile.Name);
            NFile = NFiles.GetFileAt(1);
            Assert.AreEqual("new-order-notification--123--2.xml", NFile.Name);
        }