예제 #1
0
        public void ChartRepository_Should_AddToBornedCellCountList()
        {
            var chartRepository = new ChartRepository();

            chartRepository.Should().NotBeNull();

            // AddBornedCellCount
            const int expectedValue = 10;

            chartRepository.AddBornedCellCount(expectedValue);
            chartRepository.BornedCellCountList.Count.Should().Be(1);
            chartRepository.BornedCellCountList[0].Should().Be(expectedValue);
        }
예제 #2
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]);
            }
        }
예제 #3
0
        public void ChartRepository_Should_RemoveExtraValuesFromBornedCellCountList(int count)
        {
            var chartRepository = new ChartRepository();

            chartRepository.Should().NotBeNull();

            // AddBornedCellCount
            const int length = 100;

            for (var pos = 0; pos < count; pos++)
            {
                chartRepository.AddBornedCellCount(pos);
            }
            // check BornedCellCount
            chartRepository.BornedCellCountList.Count.Should().Be(length);
            chartRepository.BornedCellCountList[0].Should().Be(count - length);
            chartRepository.BornedCellCountList[length - 1].Should().Be(count - 1);
        }
예제 #4
0
        public void ChartRepository_Should_Initialize()
        {
            var chartRepository = new ChartRepository();

            chartRepository.Should().NotBeNull();

            chartRepository.TotalCellCountList.Should().NotBeNull();
            chartRepository.TotalCellCountList.Count.Should().Be(0);

            chartRepository.BornedCellCountList.Should().NotBeNull();
            chartRepository.BornedCellCountList.Count.Should().Be(0);

            chartRepository.DiedCellCountList.Should().NotBeNull();
            chartRepository.DiedCellCountList.Count.Should().Be(0);

            chartRepository.AgeCountList.Should().NotBeNull();
            chartRepository.AgeCountList.Count.Should().Be(0);
        }
예제 #5
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);
        }