public void ExecutingThreadPrincipal_WhenUserIsSet_DoesChangePrincipal() { IPrincipal executingThreadPrincipal = null; RunCallBackTestJob.Callback = () => executingThreadPrincipal = Thread.CurrentPrincipal; var runtime = new CoreRuntime(new RuntimeConfiguration()); runtime.Execute(new ExecutionMetadata { JobType = typeof(RunCallBackTestJob).AssemblyQualifiedName, UserId = "anything" }); RunCallBackTestJob.Reset(); Assert.AreNotEqual(executingThreadPrincipal.Identity.Name, Thread.CurrentPrincipal.Identity.Name); }
public void ExecutingThreadPrincipal_WhenExecuting_CallbackIsCalled() { IPrincipal executingThreadPrincipal = null; RunCallBackTestJob.Callback = () => executingThreadPrincipal = Thread.CurrentPrincipal; var runtime = new CoreRuntime(new RuntimeConfiguration()); runtime.Execute(new ExecutionMetadata { JobType = typeof(RunCallBackTestJob).AssemblyQualifiedName }); RunCallBackTestJob.Reset(); Assert.IsNotNull(executingThreadPrincipal); }
public void ThreadPrincipal_InExecutingThread_AuthenticationTypeIsSet() { IPrincipal executingThreadPrincipal = null; RunCallBackTestJob.Callback = () => executingThreadPrincipal = Thread.CurrentPrincipal; var userName = "******"; var runtime = new CoreRuntime(new RuntimeConfiguration()); runtime.Execute(new ExecutionMetadata { JobType = typeof(RunCallBackTestJob).AssemblyQualifiedName, UserId = userName }); RunCallBackTestJob.Reset(); Assert.AreEqual("JobbrIdentity", executingThreadPrincipal.Identity.AuthenticationType); }