Esempio n. 1
0
        public void DetectServices_Found()
        {
            {
                var x = new MyLongRunning();

                var s = new MyDumbScheduler2(new Dictionary <Type, object>
                {
                    { typeof(ISchedulerLongRunning), x }
                });

                Assert.AreEqual(x, Scheduler.AsLongRunning(s));
            }

            {
                var x = new MyStopwatchProvider();

                var s = new MyDumbScheduler2(new Dictionary <Type, object>
                {
                    { typeof(IStopwatchProvider), x }
                });

                Assert.AreEqual(x, Scheduler.AsStopwatchProvider(s));
            }

            {
                var x = new MyPeriodic();

                var s = new MyDumbScheduler2(new Dictionary <Type, object>
                {
                    { typeof(ISchedulerPeriodic), x }
                });

                Assert.AreEqual(x, Scheduler.AsPeriodic(s));
            }
        }
Esempio n. 2
0
        public void DetectServices_Null_2()
        {
            var s = new MyDumbScheduler2(new Dictionary <Type, object>());

            Assert.IsNull(Scheduler.AsLongRunning(s));
            Assert.IsNull(Scheduler.AsPeriodic(s));
            Assert.IsNull(Scheduler.AsStopwatchProvider(s));
        }