コード例 #1
0
 public void Test_KnownMasses()
 {
     foreach (var testTup in TestTups)
     {
         var fuel = FuelCalculator.CalculateFuelFromMass(testTup.Item1);
         Assert.IsTrue(fuel == testTup.Item2);
     }
 }
コード例 #2
0
        public void Test_DayOne_PartOne()
        {
            //< Parse the test module masses into memory
            var testFile = Path.Combine(TestHelper.TestDir, @"Day1.Input.txt");
            var masses   = File.ReadLines(testFile).Where(line => line != "").Select(line => int.Parse(line));
            //< Calculate the fuel needs for each module
            var fuelNeeds = masses.Select(mass => FuelCalculator.CalculateFuelFromMass(mass));
            //< Calculate the total sum of fuel requirements
            var totalFuel = fuelNeeds.Sum();

            Assert.IsTrue(totalFuel == 3511949);
        }