Ejemplo n.º 1
0
        public void SolveSecondPuzzle()
        {
            var sut = new AgeModel(REAL_AGES);

            sut.Advance(256);
            Assert.Equal(1702631502303, sut.CountAllFishes());
        }
Ejemplo n.º 2
0
        public void SolveFirstPuzzle()
        {
            var sut = new AgeModel(REAL_AGES);

            sut.Advance(80);
            Assert.Equal(379114, sut.CountAllFishes());
        }
Ejemplo n.º 3
0
        public void CalculateSpawnRateCorrectly_WhenSampleDataIsUsed(int days, long expectedFishes)
        {
            var sut = new AgeModel(SAMPLE_AGES);

            sut.Advance(days);
            Assert.Equal(expectedFishes, sut.CountAllFishes());
        }
Ejemplo n.º 4
0
        public void DecrementInternalTimerCorrectly_WhenThereAreSeveralFishes()
        {
            var sut = new AgeModel(SAMPLE_AGES);

            sut.Advance(1);
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(0));
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(1));
            Assert.Equal(2, sut.CountFishesWithAnAgeOf(2));
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(3));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(4));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(5));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(6));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(7));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(8));
        }
Ejemplo n.º 5
0
        public void SpawnNewLanternfish_WhenFourDaysPassAfterInitialAgeOf3()
        {
            var sut = new AgeModel("3");

            sut.Advance(4);
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(0));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(1));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(2));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(3));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(4));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(5));
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(6));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(7));
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(8));
        }
Ejemplo n.º 6
0
        public void DecrementInternalTimerCorrectly_WhenThereIsOneFish()
        {
            var sut = new AgeModel("3");

            sut.Advance(1);
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(0));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(1));
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(2));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(3));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(4));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(5));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(6));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(7));
            Assert.Equal(0, sut.CountFishesWithAnAgeOf(8));
        }
Ejemplo n.º 7
0
        public void SpawnFishCorrectly_When18DaysPass()
        {
            var sut = new AgeModel(SAMPLE_AGES);

            sut.Advance(18);
            Assert.Equal(3, sut.CountFishesWithAnAgeOf(0));
            Assert.Equal(5, sut.CountFishesWithAnAgeOf(1));
            Assert.Equal(3, sut.CountFishesWithAnAgeOf(2));
            Assert.Equal(2, sut.CountFishesWithAnAgeOf(3));
            Assert.Equal(2, sut.CountFishesWithAnAgeOf(4));
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(5));
            Assert.Equal(5, sut.CountFishesWithAnAgeOf(6));
            Assert.Equal(1, sut.CountFishesWithAnAgeOf(7));
            Assert.Equal(4, sut.CountFishesWithAnAgeOf(8));
        }