public void TestInitialize() { EducationContext = new EducationDataContext(); Container = AssemblySetup.CreateWindsorContainer(EducationContext); RepositoryContainer repositoryContainer = new RepositoryContainer(Container, EducationContext); ScheduledServiceManager logicManager = new ScheduledServiceManager(repositoryContainer); HttpContext context = new HttpContext(new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter())); User = new EducationSecurityPrincipal(new UserRepository(EducationContext).Items.Where(s => s.UserKey == "Bob").Single()); context.User = User; Target = new ServiceController(logicManager); ControllerContext controllerContext = new ControllerContext(new HttpContextWrapper(context), new RouteData(), Target); Target.ControllerContext = controllerContext; }
public void InitializeTest() { MockLogicManager = MockRepository.GenerateMock<IScheduledServiceManager>(); Target = new ServiceController(MockLogicManager); Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target); MockHttpContext.Expect(m => m.User).Return(User); }