Esempio n. 1
0
 public void GroupBy_Spike() {
     var values = new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
     var groups = values.GroupBy(x => x % 2 == 0);
     Assert.That(groups.First().Key, Is.False);
     Assert.That(groups.First(), Is.EqualTo(new[] {1, 3, 5, 7, 9}));
 
     Assert.That(groups, Is.EqualTo(new[] { new[] { 1, 3, 5, 7, 9 }, new[] { 2, 4, 6, 8, 10 } }));
 }
Esempio n. 2
0
        public void When_starting_a_game__everyones_totems_should_be_unique()
        {
            var player1Filename = TestHelper.GetSrcFilenameFrom(browser.FindCss("img#player-1"));
              var player2Filename = TestHelper.GetSrcFilenameFrom(browser.FindCss("img#player-2"));
              var player3Filename = TestHelper.GetSrcFilenameFrom(browser.FindCss("img#player-3"));
              var player4Filename = TestHelper.GetSrcFilenameFrom(browser.FindCss("img#player-4"));
              var filenames = new[] {player1Filename, player2Filename, player3Filename, player4Filename};
              var numberOfUniqueFilenames = filenames.GroupBy(x => x).Count();

              Assert.AreEqual(4, numberOfUniqueFilenames, "Expected unique filenames, got: " + string.Join(", ", filenames));
        }
        public void GroupBy_groups_items_using_provided_equality_function()
        {
            var values = new[] { "a", "A" };

            Assert.Equal(1, values.GroupBy((a, b) => a.Equals(b, StringComparison.OrdinalIgnoreCase)).Count());
        }