private static void SolvePartOne(List <int> adapters) { Console.WriteLine("Part I"); var adapterBag = new AdapterBag(adapters); adapterBag.CheckAllAdapters(); var result = adapterBag.NumberOf1JoltDifferences * adapterBag.NumberOf3JoltDifferences; Console.WriteLine($"Result: {result}"); }
public void ShouldCountNumberOfJoltDifferences() { // Arrange var adapters = AdaptersInBag(); var adapterBag = new AdapterBag(adapters); // Act adapterBag.CheckAllAdapters(); // Assert adapterBag.NumberOf1JoltDifferences.Should().Be(7); adapterBag.NumberOf3JoltDifferences.Should().Be(5); }
public void ShouldCountNumberOfJoltDifferencesWithBiggerExample() { // Arrange var adapters = new List <int> { 28, 33, 18, 42, 31, 14, 46, 20, 48, 47, 24, 23, 49, 45, 19, 38, 39, 11, 1, 32, 25, 35, 8, 17, 7, 9, 4, 2, 34, 10, 3, }; var adapterBag = new AdapterBag(adapters); // Act adapterBag.CheckAllAdapters(); // Assert adapterBag.NumberOf1JoltDifferences.Should().Be(22); adapterBag.NumberOf3JoltDifferences.Should().Be(10); }