public void TestMethodZapsatCitace4() { Console.WriteLine($"TestMethodZapsatCitace4 - start"); using (var serialPort = new SerialPortWraper(_portCfg)) { try { serialPort.Open(); } catch (Exception ex) { Console.WriteLine(ex.Message); //throw; } Assert.IsTrue(serialPort.IsOpen, $"port {_portCfg.Port} nelze otevřít"); UnitMonitor m = new UnitMonitor(100); m.SerialPort = serialPort; var res = m.SetCitace(99, 33); Assert.IsTrue(res); serialPort.Close(); Assert.IsFalse(serialPort.IsOpen, $"port {_portCfg.Port} nelze uzařít"); Thread.Sleep(500); } Console.WriteLine($"TestMethodZapsatCitace4 - OK"); }
public void TestMethodZapsatNacistCitace() { using (var serialPort = new SerialPortWraper(_portCfg)) { serialPort.Open(); Assert.IsTrue(serialPort.IsOpen, $"port {_portCfg.Port} nelze otevřít"); UnitMonitor m = new UnitMonitor(100); m.SerialPort = serialPort; short okVal = 123; short ngVal = 54; var res = m.SetCitace(okVal, ngVal); Assert.IsTrue(res); int ok; int ng; Thread.Sleep(500); Assert.IsTrue(m.ReadStavCitacu(out ok, out ng)); Console.WriteLine($"OK={ok} NG={ng}"); Assert.AreEqual(ok, okVal); Assert.AreEqual(ng, ngVal); serialPort.Close(); Assert.IsFalse(serialPort.IsOpen, $"port {_portCfg.Port} nelze uzařít"); Thread.Sleep(500); } Console.WriteLine($"TestMethodZapsatNacistCitace - OK"); }