public static void InstructionBoxTest(Type element, string testFileName) { FileInfo boxTestFile = new FileInfo(Path.Combine(GetTestDir(), testFileName)); int dataSize = (int)boxTestFile.Length; InstructionBox boxTest = new InstructionBox(dataSize); FileStream fs = boxTestFile.Open(FileMode.Open); BinaryReader br = new BinaryReader(fs); byte[] inData = br.ReadBytes(dataSize); br.BaseStream.Seek(0, SeekOrigin.Begin); boxTest.Read(br); br.Close(); fs.Close(); byte[] outData = new byte[dataSize]; MemoryStream ms = new MemoryStream(outData); BinaryWriter bw = new BinaryWriter(ms); boxTest.Write(bw); bw.Close(); ms.Close(); Debug.Assert(inData.SequenceEqual(outData), "Input/output replication test failed for " + element.ToString()); }
// Adds defined controls to the form public void AddControls() { InstructionBox.SelectAll(); InstructionBox.SelectionAlignment = HorizontalAlignment.Center; InstructionBox.DeselectAll(); InstructionBox.ReadOnly = true; PassBox.TextChanged += PassTextChanged; Window.Controls.Add(PassBox); Window.Controls.Add(InstructionBox); }