コード例 #1
0
        public void TestAsyncReturnValue()
        {
            using (DigitalInput d = NewInput())
            {
                int    count = 0;
                object obj   = null;
                Action <uint, object> mockDelegate = (m, o) =>
                {
                    count++;
                    obj = o;
                };

                SimData.DIO[0].SetValue(false);

                d.RequestInterrupts(mockDelegate, this);
                d.EnableInterrupts();

                SimData.DIO[0].SetValue(true);

                Thread.Sleep(50);

                Assert.AreEqual(1, count);
                Assert.AreSame(this, obj);
            }
        }
コード例 #2
0
        public void TestAsync()
        {
            using (DigitalInput d = NewInput())
            {
                int    count        = 0;
                Action mockDelegate = () =>
                {
                    count++;
                };

                SimData.DIO[0].SetValue(false);

                d.RequestInterrupts(mockDelegate);
                d.EnableInterrupts();

                SimData.DIO[0].SetValue(true);

                Thread.Sleep(50);

                Assert.AreEqual(1, count);
            }
        }