private FormsAuthenticationTicketCreator GetTheTicketCreator()
        {
            var serviceLocator = new TestServiceLocator();

            serviceLocator.ResolveThisInstanceAsThisType(testPrincipalProvider);

            return(new FormsAuthenticationTicketCreator(serviceLocator));
        }
Esempio n. 2
0
        public void Instantiates_a_principal_provider_based_on_the_type_in_user_data_and_then_passes_the_username_and_data_to_it()
        {
            var expected = CreateTestPrincipal();

            var fakePrincipalProvider = new TestPrincipalProvider("username", "user data", expected);

            var ticket = CreateTicket(fakePrincipalProvider.GetType(), "username", "user data");

            var serviceLocator = new TestServiceLocator();

            serviceLocator.ResolveThisInstanceAsThisType(fakePrincipalProvider);

            var creator = new PrincipalFromTicketCreator(serviceLocator);
            var result  = creator.Create(ticket);

            result.ShouldBeSameAs(expected);
        }