コード例 #1
0
        public void Can_make_triplets_from_11_to_20()
        {
            var triplets = Triplet.Where(minFactor: 11, maxFactor: 20);
            var products = triplets.Select(x => x.Product());

            Assert.That(products, Is.EqualTo(new[] { 3840 }));
        }
コード例 #2
0
        public void Can_make_triplets_filtered_on_sum()
        {
            var triplets = Triplet.Where(sum: 180, maxFactor: 100);
            var products = triplets.Select(x => x.Product()).OrderBy(x => x);

            Assert.That(products, Is.EqualTo(new[] { 118080, 168480, 202500 }));
        }
コード例 #3
0
        public void Can_make_triplets_up_to_10()
        {
            var triplets = Triplet.Where(maxFactor: 10);
            var products = triplets.Select(x => x.Product()).OrderBy(x => x);

            Assert.That(products, Is.EqualTo(new[] { 60, 480 }));
        }