public static void Y2018_Day02_CalculateChecksum_Returns_Correct_Solution( string[] boxIds, int expected) { // Act int actual = Day02.CalculateChecksum(boxIds); // Assert actual.ShouldBe(expected); }
public void CalculateCheckSum(string input, int expectedChecksum) { // Arrange var inputLines = input.Split(','); var sut = new Day02(); // Act var result = sut.CalculateChecksum(inputLines); // Assert result.Should().Be(expectedChecksum); }
public static void Y2017_Day02_CalculateChecksum_Returns_Correct_Solution_Using_Evenly_Divisible() { // Arrange int[][] spreadsheet = new[] { new[] { 5, 9, 2, 8 }, new[] { 9, 4, 7, 3 }, new[] { 3, 8, 6, 5 }, }; // Act int actual = Day02.CalculateChecksum(spreadsheet, forEvenlyDivisible: true); // Assert actual.ShouldBe(9); }
public static void Y2017_Day02_CalculateChecksum_Returns_Correct_Solution_Using_Difference() { // Arrange int[][] spreadsheet = new[] { new[] { 5, 1, 9, 5 }, new[] { 7, 5, 3 }, new[] { 2, 4, 6, 8 }, }; // Act int actual = Day02.CalculateChecksum(spreadsheet, forEvenlyDivisible: false); // Assert actual.ShouldBe(18); }