コード例 #1
0
        public void CalculateMinimumFuelConsumptionCorrectly_WhenConsumptionIsIncremental()
        {
            var sut = SubmarineAlignment.CreateWithIncrementalConsumption(SAMPLE_POSITIONS);

            Assert.Equal(168, sut.MinimumFuelConsumption);
        }
コード例 #2
0
        public void SolveSecondPuzzle()
        {
            var sut = SubmarineAlignment.CreateWithIncrementalConsumption(REAL_POSITIONS);

            Assert.Equal(98363777, sut.MinimumFuelConsumption);
        }
コード例 #3
0
        public void SolveFirstPuzzle()
        {
            var sut = SubmarineAlignment.CreateWithConstantConsumption(REAL_POSITIONS);

            Assert.Equal(347011, sut.MinimumFuelConsumption);
        }
コード例 #4
0
        public void CalculateMinimumFuelConsumptionCorrectly(string positions, int expectedValue)
        {
            var sut = SubmarineAlignment.CreateWithConstantConsumption(positions);

            Assert.Equal(expectedValue, sut.MinimumFuelConsumption);
        }
コード例 #5
0
        public void ReturnZero_WhenAllElementsInInputAreAligned(string positions)
        {
            var sut = SubmarineAlignment.CreateWithConstantConsumption(positions);

            Assert.Equal(0, sut.MinimumFuelConsumption);
        }
コード例 #6
0
        public void ReturnZero_WhenThereIsOnlyOneElementInInput(string position)
        {
            var sut = SubmarineAlignment.CreateWithConstantConsumption(position);

            Assert.Equal(0, sut.MinimumFuelConsumption);
        }
コード例 #7
0
        public void ThrowException_WhenInitializedWithInvalidData(string invalidInput)
        {
            var exception = Assert.Throws <ArgumentException>(() => SubmarineAlignment.CreateWithConstantConsumption(invalidInput));

            Assert.Equal("Invalid input", exception.Message);
        }