Exemple #1
0
        public void ChartRepository_Should_UpdateAgeCountList()
        {
            var chartRepository = new ChartRepository();

            chartRepository.Should().NotBeNull();

            // UpdateAges
            var actualValue   = new List <int>(new[] { 1, 2, 3, 4, 5, 6, 7 });
            var expectedValue = new List <int>(new[] { 2, 3, 4, 5, 6, 7 });

            chartRepository.UpdateAges(actualValue);
            chartRepository.AgeCountList.Count.Should().Be(expectedValue.Count);
            for (var pos = 0; pos < expectedValue.Count; pos++)
            {
                chartRepository.AgeCountList[pos].Should().Be(expectedValue[pos]);
            }
        }
Exemple #2
0
        public void ChartRepository_Should_SumValuesFromAgeCountList()
        {
            var chartRepository = new ChartRepository();

            chartRepository.Should().NotBeNull();

            // init array
            const int arrayLength    = 60;
            const int expectedLength = 50;
            var       expectedValue  = new int[arrayLength];

            for (var pos = 0; pos < arrayLength; pos++)
            {
                expectedValue[pos] = 100 - pos;
            }
            // check AgeCount
            chartRepository.UpdateAges(expectedValue);
            chartRepository.AgeCountList.Count.Should().Be(expectedLength);
            chartRepository.AgeCountList[0].Should().Be(100 - 1);
            chartRepository.AgeCountList[1].Should().Be(100 - 2);
            chartRepository.AgeCountList[expectedLength - 1].Should().Be(506);
        }