Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }