예제 #1
0
 public void TestsMass()
 {
     Assert.Equal(33583, FuelMassCalculator.RequiredFuelForModule(100756));
     Assert.Equal(654, FuelMassCalculator.RequiredFuelForModule(1969));
     Assert.Equal(2, FuelMassCalculator.RequiredFuelForModule(14));
     Assert.Equal(2, FuelMassCalculator.RequiredFuelForModule(12));
 }
예제 #2
0
        public void Day1Part1()
        {
            var text = System.IO.File.ReadAllText("/Users/souriyakhaosanga/Documents/Day1/Day1/Day1Part1.txt");

            var sum = Array.ConvertAll(text.Split("\n"), Double.Parse)
                      .Select(x => FuelMassCalculator.RequiredFuelForModule((float)x))
                      .ToList()
                      .Sum();

            Assert.Equal(3311492, sum);
        }