public void IsDayComplete_ReturnsFalseWithNoDayData() { var dayItem = new ContentChannelItem { ChildItems = new ContentChannelItemAssociation[] { new ContentChannelItemAssociation { Order = 0, ChildContentChannelItem = new ContentChannelItem { Id = 1, Order = 0, Attributes = new Dictionary <string, Web.Cache.AttributeCache>(), AttributeValues = new Dictionary <string, Web.Cache.AttributeValueCache>() } }, }, Attributes = new Dictionary <string, Web.Cache.AttributeCache>(), AttributeValues = new Dictionary <string, Web.Cache.AttributeValueCache>() }; var dailyChallenge = new CachedDailyChallenge(dayItem); var dayData = new InteractionChallengeDayData(); Assert.IsFalse(IsDayComplete(dayData, dailyChallenge.ChallengeItems)); }
public void CachedDailyChallenge_ItemOrderIsCorrect() { var dayItem = new ContentChannelItem { ChildItems = new ContentChannelItemAssociation[] { new ContentChannelItemAssociation { Order = 0, ChildContentChannelItem = new ContentChannelItem { Id = 1, Order = 0, Attributes = new Dictionary <string, Web.Cache.AttributeCache>(), AttributeValues = new Dictionary <string, Web.Cache.AttributeValueCache>() } }, new ContentChannelItemAssociation { Order = 2, ChildContentChannelItem = new ContentChannelItem { Id = 3, Order = 1, Attributes = new Dictionary <string, Web.Cache.AttributeCache>(), AttributeValues = new Dictionary <string, Web.Cache.AttributeValueCache>() } }, new ContentChannelItemAssociation { Order = 1, ChildContentChannelItem = new ContentChannelItem { Id = 2, Order = 2, Attributes = new Dictionary <string, Web.Cache.AttributeCache>(), AttributeValues = new Dictionary <string, Web.Cache.AttributeValueCache>() } } }, Attributes = new Dictionary <string, Web.Cache.AttributeCache>(), AttributeValues = new Dictionary <string, Web.Cache.AttributeValueCache>() }; var dailyChallenge = new CachedDailyChallenge(dayItem); // Assert the initialized order is correct. var unorderedIds = dailyChallenge.ChallengeItems.Select(i => i.Id).ToList(); CollectionAssert.AreEqual(new List <int> { 1, 2, 3 }, unorderedIds); // Assert the order property is correct. var orderedIds = dailyChallenge.ChallengeItems.OrderBy(i => i.Order).Select(i => i.Id).ToList(); CollectionAssert.AreEqual(new List <int> { 1, 2, 3 }, orderedIds); }