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.ByMassWithFuel(mass))
                                   .Sum();

            fuelRequirements.Should().Be(4876469);
        }
Exemplo n.º 2
0
        public void FromExample(decimal mass, decimal fuelRequirement)
        {
            var result = FuelCalculator.ByMassWithFuel(mass);

            result.Should().Be(fuelRequirement);
        }