public void DoDiscoveryTest() { var container = GenerateContainer(); var agent = new SampleIOAgent(container); var sampleInterface = GenerateSampleInterface("SAMP0", "samp", "100"); var model = container.Resolve<AceModelRestricted>(); var elementList = agent.DoDiscovery(sampleInterface, model); var intfc = elementList.Where(e => e is ModelInterfaceSample).Select(i => i as ModelInterfaceSample).FirstOrDefault(); var device = elementList.Where(e => e is ModelDeviceSample).Select(d => d as ModelDeviceSample).FirstOrDefault(); Assert.IsTrue(elementList.Count == 2); Assert.IsTrue(intfc != null); Assert.IsTrue(device != null); Assert.IsTrue(intfc.VisaInterfaceId == "SAMP0"); Assert.IsTrue(intfc.SiclInterfaceId == "samp"); Assert.IsTrue(intfc.LogicalUnit == "100"); Assert.IsTrue(device.Manufacturer == "KT"); Assert.IsTrue(device.ModelNumber == "DEV001"); Assert.IsTrue(device.SerialNumber == "X01234"); Assert.IsTrue(device.FirmwareRevision == "1.0.0.1"); Assert.IsTrue(device.IPAddress == "192.168.56.128"); Assert.IsTrue(device.DeviceName == "inst0"); }
public void DoDiscoveryTest_StaticDefined() { var container1 = GenerateContainer(); var agent1 = new SampleIOAgent(container1); var sampleInterface1 = GenerateSampleInterface("SAMP1", "samp1", "101"); var model1 = container1.Resolve<AceModelRestricted>(); var elementList1 = agent1.DoDiscovery(sampleInterface1, model1); Assert.IsTrue(elementList1.Where(e => { var intfc = e as ModelInterfaceSample; return intfc != null && intfc.VisaInterfaceId == "SAMP1" && intfc.SiclInterfaceId == "samp1" && intfc.LogicalUnit == "101"; }).FirstOrDefault() == null); var container2 = GenerateContainer(); var agent2 = new SampleIOAgent(container2); var sampleInterface2 = GenerateSampleInterface("SAMP1", "samp1", "101", true); var model2 = container1.Resolve<AceModelRestricted>(); var elementList2 = agent2.DoDiscovery(sampleInterface2, model2); Assert.IsTrue(elementList2.Where(e => { var intfc = e as ModelInterfaceSample; return intfc != null && intfc.VisaInterfaceId == "SAMP1" && intfc.SiclInterfaceId == "samp1" && intfc.LogicalUnit == "101"; }).FirstOrDefault() != null); }