|
| 1 | +namespace helloserve.com.AdventOfCode.Test; |
| 2 | + |
| 3 | +[TestClass] |
| 4 | +public class Day03 |
| 5 | +{ |
| 6 | + [TestMethod] |
| 7 | + [DataRow("Day03.txt", "357")] |
| 8 | + public void Day03_Part1_Test(string filename, string expected) |
| 9 | + { |
| 10 | + var day03 = new AdventOfCode.Day03(); |
| 11 | + day03.Filename = filename; |
| 12 | + var actual = day03.Part1(); |
| 13 | + Assert.AreEqual(expected, actual); |
| 14 | + } |
| 15 | + |
| 16 | + [TestMethod] |
| 17 | + [DataRow("Day03.txt", "3121910778619")] |
| 18 | + public void Day03_Part2_Test(string filename, string expected) |
| 19 | + { |
| 20 | + var day03 = new AdventOfCode.Day03(); |
| 21 | + day03.Filename = filename; |
| 22 | + var actual = day03.Part2(); |
| 23 | + Assert.AreEqual(expected, actual); |
| 24 | + } |
| 25 | + |
| 26 | + [TestMethod] |
| 27 | + [DataRow("818181911112111", 92)] |
| 28 | + [DataRow("811111111111119", 89)] |
| 29 | + [DataRow("234234234234278", 78)] |
| 30 | + [DataRow("987654321111111", 98)] |
| 31 | + [DataRow("5342626167342261132346432442524535654423854254336833422424525424435362223322423132824617223244222225", 88)] |
| 32 | + [DataRow("3858362282172", 88)] |
| 33 | + public void Day03_BatteryBank_Part1_Test(string bank, int expected) |
| 34 | + { |
| 35 | + var b = new BatteryBank(bank, 2); |
| 36 | + Assert.AreEqual(expected, b.BankJoltage); |
| 37 | + } |
| 38 | + |
| 39 | + [TestMethod] |
| 40 | + [DataRow("818181911112111", 888911112111)] |
| 41 | + [DataRow("811111111111119", 811111111119)] |
| 42 | + [DataRow("234234234234278", 434234234278)] |
| 43 | + [DataRow("987654321111111", 987654321111)] |
| 44 | + public void Day03_BatteryBank_Part2_Test(string bank, long expected) |
| 45 | + { |
| 46 | + var b = new BatteryBank(bank, 12); |
| 47 | + Assert.AreEqual(expected, b.BankJoltage); |
| 48 | + } |
| 49 | +} |
0 commit comments