public void Constructor() { // arrange var computer = new Phase1Computer("test"); Assert.AreEqual(VoltageSignal.LOW, computer.V.V, "Constructor: Voltage"); Assert.AreEqual(VoltageSignal.LOW, computer.Clr.V, "Constructor: Clr"); Assert.AreEqual(VoltageSignal.LOW, computer.D0.V, "Constructor: D0"); Assert.AreEqual(VoltageSignal.LOW, computer.D1.V, "Constructor: D1"); Assert.AreEqual(VoltageSignal.LOW, computer.D2.V, "Constructor: D2"); Assert.AreEqual(VoltageSignal.LOW, computer.D3.V, "Constructor: D3"); Assert.AreEqual(VoltageSignal.LOW, computer.D4.V, "Constructor: D4"); Assert.AreEqual(VoltageSignal.LOW, computer.D5.V, "Constructor: D5"); Assert.AreEqual(VoltageSignal.LOW, computer.D6.V, "Constructor: D6"); Assert.AreEqual(VoltageSignal.LOW, computer.D7.V, "Constructor: D7"); Assert.AreEqual("00000000", computer.ToString(), "Constructor: ToString()"); }
private static void TestToString(Phase1Computer computer, byte expected) { string expectedString = Convert.ToString(expected, 2).PadLeft(8, '0'); Assert.AreEqual(expectedString, computer.ToString(), "ToString()"); }