public void GivenHttpWithCorrectPrincipalType_WhenIGetContextPrincipal_ThenPrincipalIsReturned()
        {
            EducationSecurityPrincipal expected = new EducationSecurityPrincipal(new User {
                UserKey = "sdklfjsw"
            });

            HttpContext.Current      = new HttpContext(new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter()));
            HttpContext.Current.User = expected;
            EducationSecurityPrincipal actual = AuthenticationUtility.GetHttpContextPrincipal();

            Assert.AreEqual(expected, actual);
        }
 public void GivenHttpContextWithAlternatePrincipalType_WhenIGetContextPrincipal_ThenReturnNull()
 {
     HttpContext.Current      = new HttpContext(new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter()));
     HttpContext.Current.User = new GenericPrincipal(new GenericIdentity("Bob"), new string[0]);
     Assert.IsNull(AuthenticationUtility.GetHttpContextPrincipal());
 }
 public void GivenHttpContextWithNullUserPrincipal_WhenIGetContextPrincipal_ThenReturnNull()
 {
     HttpContext.Current      = new HttpContext(new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter()));
     HttpContext.Current.User = null;
     Assert.IsNull(AuthenticationUtility.GetHttpContextPrincipal());
 }
 public void GivenNullHttpContext_WhenIGetContextPrincipal_ThenReturnNull()
 {
     HttpContext.Current = null;
     Assert.IsNull(AuthenticationUtility.GetHttpContextPrincipal());
 }