コード例 #1
0
        public void FromCurrentWorkerTest()
        {
            TaskShedulerWraper synchronizationContextTaskShedulerWraper = TaskShedulerWraper.Create();
            TaskScheduler      taskSheduler = synchronizationContextTaskShedulerWraper.FromCurrentWorker();

            Assert.IsNotNull(taskSheduler);
        }
コード例 #2
0
        public void FromGUIWorkerTest()
        {
            SynchronizationContext synchronizationContext = new SynchronizationContext();

            SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            TaskShedulerWraper synchronizationContextTaskShedulerWraper = TaskShedulerWraper.Create();

            Assert.IsInstanceOf(typeof(TaskScheduler), synchronizationContextTaskShedulerWraper.FromGUIWorker());
        }
コード例 #3
0
        public void FromCurrentWorker_instancesAreTheSameTest()
        {
            TaskShedulerWraper synchronizationContextTaskShedulerWraper = TaskShedulerWraper.Create();
            TaskScheduler      taskSheduler1 = synchronizationContextTaskShedulerWraper.FromCurrentWorker();
            TaskScheduler      taskSheduler2 = synchronizationContextTaskShedulerWraper.FromCurrentWorker();

            Assert.IsTrue(Object.ReferenceEquals(taskSheduler1, taskSheduler2));
            Assert.IsTrue(Object.ReferenceEquals(synchronizationContextTaskShedulerWraper.Sheduler, taskSheduler1));
        }
コード例 #4
0
        private FifoTaskQueue CreateTaskQueue()
        {
            Mock <ILogger> logger = new Mock <ILogger>();

            logger.Setup(p => p.Info(It.IsAny <string>()));
            logger.Setup(p => p.Debug(It.IsAny <string>()));
            logger.Setup(p => p.Warn(It.IsAny <string>()));
            logger.Setup(p => p.Error(It.IsAny <string>()));
            return(FifoTaskQueue.Create(TaskShedulerWraper.Create().FromCurrentWorker(),
                                        TasksProvider.Create(new List <Task>(), logger.Object), logger.Object));
        }
コード例 #5
0
        public void FromGUIWorker_instancesAreTheSameTest()
        {
            TaskShedulerWraper synchronizationContextTaskShedulerWraper = TaskShedulerWraper.Create();

            Assert.Throws(typeof(System.InvalidOperationException), delegate { synchronizationContextTaskShedulerWraper.FromGUIWorker(); });
        }