private static void Day4() { int sumOfSectorIds = 0; var reader = new StreamReader(@"..\..\Day4\input.txt"); Day4.Day4 d4p1; while (!reader.EndOfStream) { var line = reader.ReadLine(); d4p1 = new Day4.Day4(line); if (d4p1.IsRealRoom()) { sumOfSectorIds += d4p1.GetSectorId(); } if (d4p1.Decrypt().StartsWith("north")) { Console.WriteLine($"{d4p1.Decrypt()} -> {d4p1.GetSectorId()}"); } } Console.WriteLine($"Puzzle 1: {sumOfSectorIds}"); }
public void DecryptReturnsCorrectvalue(string name, string expected) { var sut = new AdventOfCode2016.Day4.Day4(name); var actual = sut.Decrypt(); Assert.Equal(expected, actual); }
public void GetNamePartReturnsCorrectValue(string name, string expected) { var sut = new AdventOfCode2016.Day4.Day4(name); var actual = sut.GetNamePart(); Assert.Equal(expected, actual); }
public void IsRealRoomReturnsCorrectValue(string name, bool expected) { var sut = new AdventOfCode2016.Day4.Day4(name); var actual = sut.IsRealRoom(); Assert.Equal(expected, actual); }
public void GetSectorIdReturnsCorrectValue(string name, int expected) { var sut = new AdventOfCode2016.Day4.Day4(name); var actual = sut.GetSectorId(); Assert.Equal(expected, actual); }
public void GetChecksumReturnsCorrectValue(string name, string expected) { var sut = new AdventOfCode2016.Day4.Day4(name); var actual = sut.CalculateChecksum(); Assert.Equal(expected, actual); }