public void GivenAnFibonacciFilter_WhenFilteringASequenceWithALargeNumber_ThenItShouldOnlyReturnFibonacciNumbersFromTheSequence()
        {
            var numbers = new NumberSequence(100);

            var filterNumbers = numbers.Process(new FibonacciNumberFilter());

            Assert.That(filterNumbers.Count, Is.EqualTo(12));
        }
 private void AddResultOfEachProcessToResult(NumberSequence numberSequence, List <ProcessResult> results)
 {
     foreach (var processor in processors)
     {
         var processedSequence = numberSequence.Process(processor);
         results.Add(new ProcessResult(processedSequence, processor.Name));
     }
 }
        public void GivenAnOddFilter_WhenFilteringASequence_ThenItShouldOnlyReturnOddNumbersFromTheSequence()
        {
            var numbers = new NumberSequence(10);

            var filterNumbers = numbers.Process(new OddNumberFilter());

            Assert.That(filterNumbers.Count, Is.EqualTo(5));
        }
        public void GivenANumberMask_WhenProcessingASequenceUsingTheMultipleOfFiveAndThreeMask_ThenItShouldReturnTheCorrectNumberOfMasks()
        {
            var mask    = new MultipleOfFiveAndThreeMask();
            var numbers = new NumberSequence(50);

            var maskedNumbers = numbers.Process(mask);

            Assert.That(maskedNumbers.Where(n => n.DisplayValue == "Z").Count(), Is.EqualTo(4));
        }
        public void GivenANumberMask_WhenProcessingASequenceUsingTheMultipleOfThreeMask_ThenItShouldMaskTheNumbersThatAreMultiplesOfThree()
        {
            var mask    = new MultipleOfThreeMask();
            var numbers = new NumberSequence(3);

            var maskedNumbers = numbers.Process(mask);

            Assert.That(maskedNumbers[0].DisplayValue, Is.EqualTo("C"));
            Assert.That(maskedNumbers[1].DisplayValue, Is.EqualTo("1"));
            Assert.That(maskedNumbers[2].DisplayValue, Is.EqualTo("2"));
            Assert.That(maskedNumbers[3].DisplayValue, Is.EqualTo("C"));
        }
        public void GivenAnOddFilter_WhenFilteringASequence_ThenItShouldOnlyReturnTheCorrectOddNumbersFromTheSequence()
        {
            var numbers = new NumberSequence(10);

            var filterNumbers = numbers.Process(new OddNumberFilter());

            Assert.That(filterNumbers[0].Value, Is.EqualTo(1));
            Assert.That(filterNumbers[1].Value, Is.EqualTo(3));
            Assert.That(filterNumbers[2].Value, Is.EqualTo(5));
            Assert.That(filterNumbers[3].Value, Is.EqualTo(7));
            Assert.That(filterNumbers[4].Value, Is.EqualTo(9));
        }
        public void GivenAnEvenFilter_WhenFilteringASequence_ThenItShouldOnlyReturnTheCorrectEvenNumbersFromTheSequence()
        {
            var numbers = new NumberSequence(10);

            var filterNumbers = numbers.Process(new EvenNumberFilter());

            Assert.That(filterNumbers[0].Value, Is.EqualTo(0));
            Assert.That(filterNumbers[1].Value, Is.EqualTo(2));
            Assert.That(filterNumbers[2].Value, Is.EqualTo(4));
            Assert.That(filterNumbers[3].Value, Is.EqualTo(6));
            Assert.That(filterNumbers[4].Value, Is.EqualTo(8));
            Assert.That(filterNumbers[5].Value, Is.EqualTo(10));
        }
        public void GivenANumberMask_WhenProcessingASequenceUsingTheCombindationMask_ThenItShouldReturnTheCorrectNumberOfMasks()
        {
            var mask = new CombinationMask(new List <NumberProcessor>()
            {
                new MultipleOfThreeMask(), new MultipleOfFiveMask(), new MultipleOfFiveAndThreeMask()
            });
            var numbers = new NumberSequence(50);

            var maskedNumbers = numbers.Process(mask);

            Assert.That(maskedNumbers.Where(n => n.DisplayValue == "E").Count(), Is.EqualTo(7));
            Assert.That(maskedNumbers.Where(n => n.DisplayValue == "Z").Count(), Is.EqualTo(4));
            Assert.That(maskedNumbers.Where(n => n.DisplayValue == "C").Count(), Is.EqualTo(13));
        }
        public void GivenANumberMask_WhenProcessingASequenceUsingTheMultipleOfFiveAndThreeMask_ThenItShouldMaskTheNumbersThatAreMultiplesOfFiveAndThree()
        {
            var mask    = new MultipleOfFiveAndThreeMask();
            var numbers = new NumberSequence(15);

            var maskedNumbers = numbers.Process(mask);

            Assert.That(maskedNumbers[0].DisplayValue, Is.EqualTo("Z"));
            Assert.That(maskedNumbers[1].DisplayValue, Is.EqualTo("1"));
            Assert.That(maskedNumbers[2].DisplayValue, Is.EqualTo("2"));
            Assert.That(maskedNumbers[3].DisplayValue, Is.EqualTo("3"));
            Assert.That(maskedNumbers[4].DisplayValue, Is.EqualTo("4"));
            Assert.That(maskedNumbers[5].DisplayValue, Is.EqualTo("5"));
            Assert.That(maskedNumbers[6].DisplayValue, Is.EqualTo("6"));
            Assert.That(maskedNumbers[7].DisplayValue, Is.EqualTo("7"));
            Assert.That(maskedNumbers[8].DisplayValue, Is.EqualTo("8"));
            Assert.That(maskedNumbers[9].DisplayValue, Is.EqualTo("9"));
            Assert.That(maskedNumbers[10].DisplayValue, Is.EqualTo("10"));
            Assert.That(maskedNumbers[11].DisplayValue, Is.EqualTo("11"));
            Assert.That(maskedNumbers[12].DisplayValue, Is.EqualTo("12"));
            Assert.That(maskedNumbers[13].DisplayValue, Is.EqualTo("13"));
            Assert.That(maskedNumbers[14].DisplayValue, Is.EqualTo("14"));
            Assert.That(maskedNumbers[15].DisplayValue, Is.EqualTo("Z"));
        }