public static void DefaultPrincipalPolicyTest_Desktop() { DummyClass.RemoteInvoke(() => { Assert.Equal(string.Empty, Thread.CurrentPrincipal.Identity.Name); }).Dispose(); }
public static void ApartmentState_NoAttributePresent_STA_Unix() { DummyClass.RemoteInvoke(() => { Assert.Throws <PlatformNotSupportedException>(() => Thread.CurrentThread.SetApartmentState(ApartmentState.STA)); }).Dispose(); }
public static void DefaultPrincipalPolicyTest() { DummyClass.RemoteInvoke(() => { Assert.Null(Thread.CurrentPrincipal); }).Dispose(); }
public static void ApartmentState_NoAttributePresent_DefaultState_Nano() { DummyClass.RemoteInvoke(() => { Assert.Throws <InvalidOperationException>(() => Thread.CurrentThread.SetApartmentState(ApartmentState.STA)); Assert.Equal(ApartmentState.MTA, Thread.CurrentThread.GetApartmentState()); }).Dispose(); }
public static void ApartmentState_NoAttributePresent_DefaultState_Unix() { DummyClass.RemoteInvoke(() => { Assert.Equal(ApartmentState.Unknown, Thread.CurrentThread.GetApartmentState()); Assert.Throws <PlatformNotSupportedException>(() => Thread.CurrentThread.SetApartmentState(ApartmentState.MTA)); }).Dispose(); }
public static void UnauthenticatedPrincipalTest() { DummyClass.RemoteInvoke(() => { AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.UnauthenticatedPrincipal); Assert.Equal(string.Empty, Thread.CurrentPrincipal.Identity.Name); }).Dispose(); }
public static void WindowsPrincipalPolicyTest_Unix() { DummyClass.RemoteInvoke(() => { AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); Assert.Throws <PlatformNotSupportedException>(() => Thread.CurrentPrincipal); }).Dispose(); }
public static void WindowsPrincipalPolicyTest_Windows() { DummyClass.RemoteInvoke(() => { AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); Assert.Equal(Environment.UserDomainName + @"\" + Environment.UserName, Thread.CurrentPrincipal.Identity.Name); }).Dispose(); }
public static void CurrentPrincipal_SetNull() { // We run test on remote process because we need to set same principal policy // On netfx default principal policy is PrincipalPolicy.UnauthenticatedPrincipal DummyClass.RemoteInvoke(() => { AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.NoPrincipal); Assert.Null(Thread.CurrentPrincipal); Thread.CurrentPrincipal = null; Assert.Null(Thread.CurrentPrincipal); Thread.CurrentPrincipal = new ClaimsPrincipal(); Assert.IsType <ClaimsPrincipal>(Thread.CurrentPrincipal); Thread.CurrentPrincipal = null; Assert.Null(Thread.CurrentPrincipal); Thread.CurrentPrincipal = new ClaimsPrincipal(); Assert.IsType <ClaimsPrincipal>(Thread.CurrentPrincipal); }).Dispose(); }