public ReplicatedItem(FileData fileData) { this.ID = ExtractID(fileData.Name); // assumes file date equals published this.PublishedDateUtc = fileData.Updated.ToUniversalTime(); this.Path = fileData.VirtualPath; }
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))); }
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); }