Пример #1
0
                public void ShouldReturnInitialTerm()
                {
                    var     progression = new ArithmeticSequence(42, 314);
                    decimal firstTerm   = progression.GetSum(1);

                    firstTerm.Should().Be(42);
                }
Пример #2
0
        public object GetResult()
        {
            const int max = 1000;

            const int threesCount   = (max - 1) / 3;
            const int fivesCount    = (max - 1) / 5;
            const int fifteensCount = (max - 1) / (3 * 5);

            var threes   = new ArithmeticSequence(3, 3);
            var fives    = new ArithmeticSequence(5, 5);
            var fifteens = new ArithmeticSequence(15, 15);

            return((int)(threes.GetSum(threesCount) + fives.GetSum(fivesCount) - fifteens.GetSum(fifteensCount)));
        }