public void ParserTest() { const string str = @" 4,W8a_KQC C Off ,,,0"; var channelInfo = new DigitalChannelInformation(str); Assert.That(channelInfo.Index, Is.EqualTo(4)); Assert.That(channelInfo.Name, Is.EqualTo("W8a_KQC C Off")); Assert.That(channelInfo.Phase, Is.EqualTo("")); Assert.That(channelInfo.CircuitComponent, Is.EqualTo("")); Assert.That(channelInfo.NormalState, Is.EqualTo(false)); }
static void TestDigitalChannelInformation() { Console.WriteLine("TestDigitalChannelInformation-TestStart"); string testStr = "1,Popular Va-g,,,0"; var row = new DigitalChannelInformation(testStr); Console.Write(row.RowToString()); testStr = "3,Ia over,,,0"; row.StringToRow(testStr); Console.Write(row.RowToString()); Console.WriteLine("TestAnalogChannelInformation-TestEnd"); while (true) { try { Console.WriteLine(); Console.Write("Input:"); var instr = Console.ReadLine(); if (instr == "q") { return; } else { row.StringToRow(instr); Console.WriteLine("ChannelIndex:" + row.ChannelIndex); Console.WriteLine("ChannelID:" + row.ChannelID); Console.WriteLine("MonitorComponent:" + row.MonitorComponent); Console.WriteLine("ChannelPhaseID:" + row.ChannelPhaseID); Console.WriteLine("StatusNormal:" + row.StatusNormal); Console.WriteLine("TestEnd"); Console.WriteLine(); } } catch (Exception ex) { Console.WriteLine("Exception:"); Console.WriteLine(ex.Message); } } }