コード例 #1
0
        public ReplicatedItem(FileData fileData)
        {
            this.ID = ExtractID(fileData.Name);

            // assumes file date equals published
            this.PublishedDateUtc = fileData.Updated.ToUniversalTime();
            this.Path = fileData.VirtualPath;
        }
コード例 #2
0
 public void ReplicatedItem_CanCompareDates()
 {
     var fd = new FileData();
     fd.Name = "1";
     fd.Updated = DateTime.Now;
     var ri = new ReplicatedItem(fd);
     Assert.That(ri.PublishedDateEquals(fd.Updated));
     Assert.That(ri.PublishedDateEquals(fd.Updated.ToUniversalTime()));
     Assert.That(ri.IsOlderThan(DateTime.Now.AddSeconds(1)));
     Assert.That(ri.IsNewerThan(DateTime.Now.AddMinutes(-1)));
 }
コード例 #3
0
 public void ReplicatedItem_CanParseID()
 {
     var fd = new FileData();
     fd.Name = "page_1234_666.xml";
     fd.Updated = DateTime.Now;
     var ri = new ReplicatedItem(fd);
     Assert.AreEqual(1234, ri.ID);
 }