public void CheckNodeInfoListAccordingToConnectionStatus() { var connection = new TestConnection(); var nodeinfogetter = new TestNodeInfoGetter(); var model = new Jupiter.Models.NodeInfoDataGridModel(connection, nodeinfogetter); var reference = new OPCUAReference(null, null, null); model.Update(reference); var expectedNodeInfoList0 = new ObservableCollection <NodeInfo>() { new NodeInfo() { Name = "Var1", Value = "1234" }, new NodeInfo() { Name = "Var2", Value = "1234567890" }, new NodeInfo() { Name = "Var3", Value = "-1234.5678" }, new NodeInfo() { Name = "Var4", Value = "abcdefghij" }, }; Assert.AreEqual(model.NodeInfoList.Count, 4); for (int i = 0; i < 4; i++) { var actual = model.NodeInfoList[i]; var expect = expectedNodeInfoList0[i]; Assert.AreEqual(actual.Name, expect.Name); Assert.AreEqual(actual.Value, expect.Value); } connection.Connected = true; connection.Connected = false; Assert.AreEqual(model.NodeInfoList.Count, 0); }
public void CheckNodeInfoListAfterExecutingUpdate() { var connection = new TestConnection(); var nodeinfogetter = new TestNodeInfoGetter(); var model = new Jupiter.Models.NodeInfoDataGridModel(connection, nodeinfogetter); var reference = new OPCUAReference(null, null, null); model.Update(reference); var expectedNodeInfoList0 = new ObservableCollection <NodeInfo>() { new NodeInfo() { Name = "Var1", Value = "1234" }, new NodeInfo() { Name = "Var2", Value = "1234567890" }, new NodeInfo() { Name = "Var3", Value = "-1234.5678" }, new NodeInfo() { Name = "Var4", Value = "abcdefghij" }, }; Assert.AreEqual(model.NodeInfoList.Count, 4); for (int i = 0; i < 4; i++) { var actual = model.NodeInfoList[i]; var expect = expectedNodeInfoList0[i]; Assert.AreEqual(actual.Name, expect.Name); Assert.AreEqual(actual.Value, expect.Value); } reference.NodeId = new ExpandedNodeId("1"); model.Update(reference); var expectedNodeInfoList1 = new ObservableCollection <NodeInfo>() { new NodeInfo() { Name = "変数1", Value = "1234" }, new NodeInfo() { Name = "変数2", Value = "1234567890" }, new NodeInfo() { Name = "変数3", Value = "-1234.5678" }, new NodeInfo() { Name = "変数4", Value = "abcdefghij" }, new NodeInfo() { Name = "変数5", Value = "あいうえお" }, }; Assert.AreEqual(model.NodeInfoList.Count, 5); for (int i = 0; i < 4; i++) { var actual = model.NodeInfoList[i]; var expect = expectedNodeInfoList1[i]; Assert.AreEqual(actual.Name, expect.Name); Assert.AreEqual(actual.Value, expect.Value); } }