public void MyTestInitialize() { // Helper code to get the HttpContext var mySIMPLTestContext = new SIMPLTestContext(); HttpContext.Current = mySIMPLTestContext.GetHttpSession(); // Helper Code to get the user logged into Windows var userName = mySIMPLTestContext.GetNameFromWindowsIdentity(); // Calling actual production code to set the instance for this username CurrentUser.SetInstance(userName); // Calling actual production code to get the Rosettian User Object RosettianUser = CurrentUser.AsUserDto(); BusinessFacadeforTests = DependencyResolver.Current.GetService<IBusinessFacade>(); SubscriberHelperforTests = DependencyResolver.Current.GetService<SubscriberHelper>(); // Set up the SubscriberController SubscriberControllerForTests = DependencyResolver.Current.GetService<SubscriberController>(); SubscriberControllerForTests.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), SubscriberControllerForTests); }
public void MyTestInitialize() { // Helper code to get the HttpContext var mySIMPLTestContext = new SIMPLTestContext(); HttpContext.Current = mySIMPLTestContext.GetHttpSession(); // Helper Code to get the user logged into Windows var userName = mySIMPLTestContext.GetNameFromWindowsIdentity(); // Calling actual production code to set the instance for this username CurrentUser.SetInstance(userName); // Calling actual production code to get the Rosettian User Object RosettianUser = CurrentUser.AsUserDto(); // Set up the PhoneController PhoneControllerForTests = new PhoneController(); PhoneControllerForTests.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), PhoneControllerForTests); }
public void MyTestInitialize() { // Setup context var mySimplTestContext = new SIMPLTestContext(); HttpContext.Current = mySimplTestContext.GetHttpSession(); var userName = mySimplTestContext.GetNameFromWindowsIdentity(); CurrentUser.SetInstance(userName); RosettianUser = CurrentUser.AsUserDto(); OrderHistoryController4Test = DependencyResolver.Current.GetService<OrderHistoryController>(); OrderHistoryController4Test.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), OrderHistoryController4Test); }
public void MyTestInitialize() { // Helper code to get the HttpContext SIMPLTestContext mySIMPLTestContext = new SIMPLTestContext(); HttpContext.Current = mySIMPLTestContext.GetHttpSession(); // Helper Code to get the user logged into Windows var userName = mySIMPLTestContext.GetNameFromWindowsIdentity(); // Calling actual production code to set the instance for this username CurrentUser.SetInstance(userName); // Calling actual production code to get the Rosettian User Object RosettianUser = CurrentUser.AsUserDto(); // TODO: Instantiation should be accomplished using Autofac as described by Wiki item http://iteverett.corp.ftr.com/Team%20Wiki/Autofac%20Test%20Initialization.aspx var rosettianClient = new RosettianClient(); var errorLoggingService = new ErrorLoggingService(); // Set up the SubscriberController PpvVodController = new PPV_VODController(rosettianClient, errorLoggingService); PpvVodController.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), PpvVodController); }