public void RoundTrips(string line, string password) { var scrambled = Scrambler.ProcessLine(line, password); Console.Out.WriteLine(scrambled); var unscrambled = Scrambler.UnProcessLine(line, scrambled); Assert.AreEqual(password, unscrambled); }
public void Examples(string line, string password, string expectedPassword) { var newPassword = Scrambler.ProcessLine(line, password); Assert.AreEqual(expectedPassword, newPassword); var rtPassword = Scrambler.UnProcessLine(line, newPassword); Assert.AreEqual(password, rtPassword); }
public void Part2() { var scrambledPassword = "******"; string unscrambled = File.ReadAllLines($"{TestContext.CurrentContext.TestDirectory}\\input.txt").Reverse().Aggregate(scrambledPassword, (password, line) => { var thisUnscrambled = Scrambler.UnProcessLine(line, password); return(thisUnscrambled); }); Console.Out.WriteLine(unscrambled); }
public void Part1() { var initialPassword = "******"; string scrambled = File.ReadAllLines($"{TestContext.CurrentContext.TestDirectory}\\input.txt").Aggregate(initialPassword, (password, line) => { var thisScrambled = Scrambler.ProcessLine(line, password); var orig = Scrambler.UnProcessLine(line, thisScrambled); Assert.AreEqual(password, orig); return(thisScrambled); }); Console.Out.WriteLine(scrambled); }