public void ConvertToSyndicationItem_With_Categories() { var entry = new BlogEntry() { BlogEntryId = Guid.NewGuid(), Title = "My unit test title", Content = "<p>this is some content</p>", CreationDate = DateTimeOffset.Now.AddDays(-2), LastUpdateDate = DateTimeOffset.Now, Author = new Person() { DisplayName = "Ronald Rosier", EmailHash = "*****@*****.**" }, Categories = { new Category() { Name = "Cat1", Value = "cat1" }, new Category() { Name = "Cat2", Value = "cat2" } } }; var syndicationItem = entry.ConvertToSyndicationItem(new Uri("http://unittest.ronaldrosier.net")); Assert.AreEqual(2, syndicationItem.Categories.Count); }
public void ConvertToSyndicationItem_SimpleEntry() { var entry = new BlogEntry() { BlogEntryId = Guid.NewGuid(), Title = "My unit test title", Content = "<p>this is some content</p>", CreationDate = DateTimeOffset.Now.AddDays(-2), LastUpdateDate = DateTimeOffset.Now, Author = new Person() { DisplayName = "Ronald Rosier", EmailHash = "*****@*****.**" } }; var syndicationItem = entry.ConvertToSyndicationItem(new Uri("http://unittest.ronaldrosier.net")); Assert.IsNotNull(syndicationItem, "Expected an item"); Assert.AreEqual(entry.BlogEntryId.ToString(), syndicationItem.Id); Assert.AreEqual(entry.CreationDate, syndicationItem.PublishDate); Assert.AreEqual(entry.LastUpdateDate, syndicationItem.LastUpdatedTime); Assert.AreEqual(entry.Title, syndicationItem.Title.Text); Assert.AreEqual(entry.Content, ((TextSyndicationContent)syndicationItem.Content).Text); Assert.AreEqual(1, syndicationItem.Authors.Count, "Expected only 1 author"); }