示例#1
0
        public void SolveFirstPuzzle()
        {
            var sut = SubmarineAlignment.CreateWithConstantConsumption(REAL_POSITIONS);

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

            Assert.Equal(expectedValue, sut.MinimumFuelConsumption);
        }
示例#3
0
        public void ReturnZero_WhenThereIsOnlyOneElementInInput(string position)
        {
            var sut = SubmarineAlignment.CreateWithConstantConsumption(position);

            Assert.Equal(0, sut.MinimumFuelConsumption);
        }
示例#4
0
        public void ReturnZero_WhenAllElementsInInputAreAligned(string positions)
        {
            var sut = SubmarineAlignment.CreateWithConstantConsumption(positions);

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

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