Exemplo n.º 1
0
 public void PasswordMatrix()
 {
   var matrix = new PasswordMatrix(Resources.PasswordMatrix6x5);
   Assert.AreEqual(6, matrix.Width);
   Assert.AreEqual(5, matrix.Height);
   var pretty = new StringBuilder();
   var actualText = new StringBuilder();
   var expectedQueue = new Queue<string>(Resources.PasswordMatrixOutput.Replace("\r", "").Split('\n'));
   foreach (var blueprint in matrix.GetAllBlueprints(5))
   {
     var value = matrix.GetPasswordValue(blueprint);
     var actual = value ?? "(none)";
     var expected = expectedQueue.Dequeue();
     Assert.AreEqual(expected, actual);
     actualText.AppendLine(actual);
     if (value != null)
       pretty.AppendLine($"{blueprint} - {value}");
   }
   // Comment the assert and uncomment the next line to store the actual output.
   // System.IO.File.WriteAllText(@"C:\io\m2qwdu", actualText.ToString());
   // Comment the assert and uncomment the next line to store the pretty output.
   // System.IO.File.WriteAllText(@"C:\io\m2qwdu", pretty.ToString());
 }