public static void RepositoryTestSetup(TestContext context) { fakeDb = new FakeFreedomCalculatorContext(); fakeBudgets = new FakeBudgetSet(); fakeAssets = new FakeAssetSet(); fakeDate = DateTime.Now; fakeDb.Budgets = fakeBudgets; fakeDb.Assets = fakeAssets; repository = new FreedomCalculatorRepository(fakeDb, null, null); }
public FreedomCalculatorBaseController(IFreedomCalculatorContext context, IZillowClient zillowClient, IYahooFinanceClient yahooFinanceClient) { repository = new FreedomCalculatorRepository(context, zillowClient, yahooFinanceClient); IPrincipal user = System.Web.HttpContext.Current.User; if (user.Identity.IsAuthenticated) { // if user id isn't already in the session, save it for later queries to the repository object objUserId = System.Web.HttpContext.Current.Session["userid"]; if (objUserId == null) { UserProfile profile = repository.GetUserByName(user.Identity.Name); System.Web.HttpContext.Current.Session["userid"] = userId = profile.UserId; } else { userId = (int)objUserId; } } }
public AccountController(IWebSecurity webSecurity, IFreedomCalculatorContext context, IZillowClient zillowClient, IYahooFinanceClient yahooFinanceClient) { this.webSecurity = webSecurity; repository = new FreedomCalculatorRepository(context, zillowClient, yahooFinanceClient); }