예제 #1
0
 public IviSwtchAdapter(string name, bool idQuery, bool reset, string options)
     : base(name, idQuery, reset, options)
 {
     SwtchChannelCollection = new IviSwtchChannelCollection(this);
     SwtchPath = new IviSwtchPath(this);
     SwtchScan = new IviSwtchScan(this);
 }
예제 #2
0
        public void Path()
        {
            IIviSwtchPath Path = Swtch.Path;

            Assert.IsNotNull(Path);

            string ch1 = "00C";
            string ch2 = "00NC";
            string ch3 = "00NO";

            Assert.AreEqual(PathCapability.Available, Path.CanConnect(ch1, ch2));
            Assert.AreEqual(PathCapability.Available, Path.CanConnect(ch1, ch3));
            Assert.AreEqual(PathCapability.Unsupported, Path.CanConnect(ch2, ch3));
            Path.Connect(ch1, ch2);
            Assert.AreEqual(PathCapability.Exists, Path.CanConnect(ch1, ch2));
            Assert.AreEqual(PathCapability.ResourceInUse, Path.CanConnect(ch1, ch3));
            Assert.AreEqual(PathCapability.Unsupported, Path.CanConnect(ch2, ch3));
            try
            {
                Path.Disconnect(ch1, ch2);
            }
            catch (Exception e)
            {
                Assert.IsInstanceOf(typeof(InstrumentStatusException), e);
                Assert.AreEqual("Some connections remain after disconnecting.", ((InstrumentStatusException)e).Message);
            }


            Assert.AreEqual(PathCapability.Available, Path.CanConnect(ch1, ch2));
            Assert.AreEqual(PathCapability.Available, Path.CanConnect(ch1, ch3));
            Assert.AreEqual(PathCapability.Unsupported, Path.CanConnect(ch2, ch3));
            Path.Connect(ch1, ch3);
            Assert.AreEqual(PathCapability.ResourceInUse, Path.CanConnect(ch1, ch2));
            Assert.AreEqual(PathCapability.Exists, Path.CanConnect(ch1, ch3));
            Assert.AreEqual(PathCapability.Unsupported, Path.CanConnect(ch2, ch3));
            try
            {
                Path.Disconnect(ch1, ch3);
            }
            catch (Exception e)
            {
                Assert.IsInstanceOf(typeof(InstrumentStatusException), e);
                Assert.AreEqual("Some connections remain after disconnecting.", ((InstrumentStatusException)e).Message);
            }
        }