public void FromCurrentWorkerTest() { TaskShedulerWraper synchronizationContextTaskShedulerWraper = TaskShedulerWraper.Create(); TaskScheduler taskSheduler = synchronizationContextTaskShedulerWraper.FromCurrentWorker(); Assert.IsNotNull(taskSheduler); }
public void FromGUIWorkerTest() { SynchronizationContext synchronizationContext = new SynchronizationContext(); SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); TaskShedulerWraper synchronizationContextTaskShedulerWraper = TaskShedulerWraper.Create(); Assert.IsInstanceOf(typeof(TaskScheduler), synchronizationContextTaskShedulerWraper.FromGUIWorker()); }
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)); }
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)); }
public void FromGUIWorker_instancesAreTheSameTest() { TaskShedulerWraper synchronizationContextTaskShedulerWraper = TaskShedulerWraper.Create(); Assert.Throws(typeof(System.InvalidOperationException), delegate { synchronizationContextTaskShedulerWraper.FromGUIWorker(); }); }