Exemplo n.º 1
0
        public void FromInput()
        {
            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = "input-part-one.txt";

            var input            = Utilities.EmbeddedResource.Get(resourceName, assembly);
            var fuelRequirements = input.Split(Environment.NewLine)
                                   .AsParallel()
                                   .Select(value => decimal.Parse(value))
                                   .Select(mass => FuelCalculator.ByMass(mass))
                                   .Sum();

            fuelRequirements.Should().Be(3252897);
        }
Exemplo n.º 2
0
        public void FromExample(int mass, int expectedFuelRequirements)
        {
            var fuelRequirements = FuelCalculator.ByMass(mass);

            fuelRequirements.Should().Be(expectedFuelRequirements);
        }