Exemplo n.º 1
0
 private void singleRun(Counters counters)
 {
     using (var cbSource = new CallbackSource())
     {
         cbSource.SetInterface(new CallbackFinalizerCounterImpl(counters));
         cbSource.SetValue(76);
     }
 }
Exemplo n.º 2
0
        public void CallbackTest()
        {
            using (var cbSource = new CallbackSource())
            {
                var cb = new CallbackImpl();
                cbSource.SetInterface(cb);

                Assert.Equal(0u, cb.lastValue);
                var result = cbSource.SetValue(76);
                Assert.Equal(76u, result);
                Assert.Equal(76u, cb.lastValue);

                Assert.Equal(TimeSpan.MinValue, cb.lastDuration);
                var timeResult = cbSource.SetDuration(TimeSpan.FromSeconds(76));
                Assert.Equal(TimeSpan.FromSeconds(76), timeResult);
                Assert.Equal(TimeSpan.FromSeconds(76), cb.lastDuration);
            }
        }