public PlayerFeedsSyncResult( IEnumerable <PlayerFeedRow> playerFeedRows, IEnumerable <PlayerFeed> playerFeeds) { var playerFeedRowsByID = playerFeedRows.ToDictionary(r => r.Url); var playerFeedsByID = playerFeeds.ToDictionary(f => f.Url); DefunctPlayerFeedRows = playerFeedRowsByID.Values .Where(r => !playerFeedsByID.ContainsKey(r.Url)) .ToArray(); NewPlayerFeedRows = PlayerFeedRow.CreateRows(playerFeedsByID.Values .Where(f => !playerFeedRowsByID.ContainsKey(f.Url))) .ToArray(); }
public void CreateRows() { var playerFeeds = Enumerable.Range(0, 26) .Select(i => new PlayerFeed { Url = ((char)('a' + i)).ToString() }); var playerFeedRows = PlayerFeedRow.CreateRows(playerFeeds).ToArray(); Assert.AreEqual(26, playerFeedRows.Length); CollectionAssert.AreEqual( playerFeeds.Select(f => f.Url).ToArray(), playerFeedRows.Select(r => r.Url).ToArray()); Assert.IsTrue(playerFeedRows.All(r => r.PartitionKey == "0")); Assert.AreEqual(playerFeedRows.Length, playerFeedRows.Select(r => r.RowKey).Distinct().Count()); }