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 LocationController LocationController4Tests = DependencyResolver.Current.GetService<LocationController>(); LocationController4Tests.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), LocationController4Tests); }
public void MyTestInitialize() { // Setup context var mySimplTestContext = new SIMPLTestContext(); HttpContext.Current = mySimplTestContext.GetHttpSession(); var userName = mySimplTestContext.GetNameFromWindowsIdentity(); CurrentUser.SetInstance(userName); RosettianUser = CurrentUser.AsUserDto(); // Setup ResidentialGatewayController BusinessFacadeforTests = DependencyResolver.Current.GetService<IBusinessFacade>(); EquipmentControllor4Test = DependencyResolver.Current.GetService<EquipmentController>(); EquipmentControllor4Test.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), EquipmentControllor4Test); }
public void MyTestInitialize() { // Setup context var mySimplTestContext = new SIMPLTestContext(); HttpContext.Current = mySimplTestContext.GetHttpSession(); var userName = mySimplTestContext.GetNameFromWindowsIdentity(); CurrentUser.SetInstance(userName); RosettianUser = CurrentUser.AsUserDto(); // Instantiate FacilitiesController used for tests implemented in this class BusinessFacadeforTests = DependencyResolver.Current.GetService<IBusinessFacade>(); FacilitiesController4Test = DependencyResolver.Current.GetService<FacilitiesController>(); FacilitiesController4Test.ControllerContext = new ControllerContext ( new HttpContextWrapper(HttpContext.Current), new RouteData(), FacilitiesController4Test ); }
public void MyTestInitialize() { // Setup context var mySimplTestContext = new SIMPLTestContext(); HttpContext.Current = mySimplTestContext.GetHttpSession(); var userName = mySimplTestContext.GetNameFromWindowsIdentity(); CurrentUser.SetInstance(userName); CheckinController = DependencyResolver.Current.GetService<CheckinController>(); CheckinController.ControllerContext = new ControllerContext(new HttpContextWrapper(HttpContext.Current), new RouteData(), CheckinController); }