public void InitializeTest() { EducationContext = new EducationDataContext(); Container = AssemblySetup.CreateWindsorContainer(EducationContext); RepositoryContainer repositoryContainer = new RepositoryContainer(Container, EducationContext); SchoolDistrictManager logicManager = new SchoolDistrictManager(repositoryContainer, new DataTableBinder(), new UserAuditor()); Target = new StudentController(logicManager); User userEntity = EducationContext.Users.Include("UserRoles.Role").Include("UserRoles.Schools").Include("UserRoles.Providers").Single(s => s.UserKey == "Bob"); User = new EducationSecurityPrincipal(userEntity); MockHttpContext = MockHttpContextFactory.Create(); MockHttpContext.Expect(m => m.User).Return(User); ControllerContext context = new ControllerContext(MockHttpContext, new RouteData(), Target); Target.ControllerContext = context; }
public void InitializeTest() { MockLogicManager = MockRepository.GenerateMock<ISchoolDistrictManager>(); Target = new StudentController(MockLogicManager); Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target); MockHttpContext.Expect(m => m.User).Return(User); }