public Specification when_updating_status_with_access_token() { const string statusText = "some test status"; var statusViewModel = new StatusViewModel { Status = statusText }; ISessionAdapter session = sessionFactory(); var testDbContext = new TestDbContext(); Container container = containerFactory(testDbContext); var mockTwitterProvider = MockTwitterProvider(statusText); container.TwitterServiceFactory = () => mockTwitterProvider.Object; int statusCount = testDbContext.Statuses.Count; return(new ActionSpecification <TwitterController> { On = () => { session.SetTwitterAccessToken(new OAuthToken("", "")); return GetTwitterController(container, session); }, When = ctrl => ctrl.UpdateStatus(statusViewModel), Expect = { ctrl => testDbContext.Statuses.Count == statusCount + 1, ctrl => testDbContext.Statuses.Last().Value.Text == statusText, }, }); }
public GameModule( ICacheAdapter appCache, ISessionAdapter session, IResponseAdapter response) : base(appCache, session, response) { }
public FillFileHistory(ISessionAdapter sessionAdapter, IRepository api, ReviewRevision currentRevision, FeatureToggle features) { _sessionAdapter = sessionAdapter; _api = api; _currentRevision = currentRevision; _features = features; }
public EnergyTankModule( ICacheAdapter appCache, ISessionAdapter session, IResponseAdapter response) : base(appCache, session, response) { }
public static bool ValidateJSONRequestSessionHasAdminOpsLevel( ISessionAdapter session, out string error_code) { bool success = true; int session_account_id = GetSessionAccountID(session); DatabaseConstants.OpsLevel opsLevel = AccountQueries.GetAccountOpsLevel( ApplicationConstants.CONNECTION_STRING, session_account_id, out error_code); if (opsLevel != DatabaseConstants.OpsLevel.invalid) { if (opsLevel >= DatabaseConstants.OpsLevel.admin) { error_code = SuccessMessages.GENERAL_SUCCESS; success = true; } else { error_code = ErrorMessages.INSUFFICIENT_OPS_LEVEL; } } return(success); }
public static bool ValidateJSONRequestSessionHasAdminOpsLevel( ISessionAdapter session, out string error_code) { bool success = true; int session_account_id = GetSessionAccountID(session); DatabaseConstants.OpsLevel opsLevel = AccountQueries.GetAccountOpsLevel( ApplicationConstants.CONNECTION_STRING, session_account_id, out error_code); if (opsLevel != DatabaseConstants.OpsLevel.invalid) { if (opsLevel >= DatabaseConstants.OpsLevel.admin) { error_code = SuccessMessages.GENERAL_SUCCESS; success = true; } else { error_code = ErrorMessages.INSUFFICIENT_OPS_LEVEL; } } return success; }
public EffortsController(ISessionAdapter sessionAdapter, IAddNewJobTaskComboCommand addNewJobTaskComboCommand, IRemoveRowCommand removeRowCommand, IModifyJobTaskComboCommand modifyJobTaskComboCommand) { _sessionAdapter = sessionAdapter; _addNewJobTaskComboCommand = addNewJobTaskComboCommand; _removeRowCommand = removeRowCommand; _modifyJobTaskComboCommand = modifyJobTaskComboCommand; }
public AccountModule( ICacheAdapter appCache, ISessionAdapter session, IResponseAdapter response) : base(appCache, session, response) { }
public static bool VerifySessionOwnsCharacter(ISessionAdapter session, int character_id) { int[] characters_ids = (int[])session["CharacterIDs"]; bool sessionOwnsCharacter = characters_ids.Contains(character_id); return(sessionOwnsCharacter); }
public CharacterModule( ICacheAdapter appCache, ISessionAdapter session, IResponseAdapter response) : base(appCache, session, response) { }
public Specification when_updating_status_with_invalid_model() { string statusText = new string('*', 141); var statusViewModel = new StatusViewModel { Status = statusText }; ISessionAdapter session = sessionFactory(); var testDbContext = new TestDbContext(); Container container = containerFactory(testDbContext); int maxId = testDbContext.Statuses.Max(_ => _.Key); return(new QuerySpecification <TwitterController, ViewResult> { On = () => { session.SetTwitterAccessToken(new OAuthToken("", "")); return GetTwitterController(container, session); }, When = ctrl => ctrl.UpdateStatus(statusViewModel) as ViewResult, Expect = { routeResult => routeResult.ViewName == "Send", }, }); }
protected TwitterController GetTwitterController(Container container = null, ISessionAdapter session = null) { return new TwitterController(container, session) { ControllerContext = new ControllerContext() }; }
public QuickJobTimeReportQuery(IConfiguration configuration, ISessionAdapter sessionAdapter, IJobsRepository jobsRepository, ISitesRepository sitesRepository, IClientsRepository clientsRepository) { this.configuration = configuration; _sessionAdapter = sessionAdapter; _jobsRepository = jobsRepository; _sitesRepository = sitesRepository; _clientsRepository = clientsRepository; }
public ExpenseController(IJobsRepository jobsService, ISessionAdapter sessionAdapter, IExpenseService expenseService, IConfiguration config, IUploadLocationResolver uploadLocationResolver) { _jobsService = jobsService; _sessionAdapter = sessionAdapter; _expenseService = expenseService; _config = config; _uploadLocationResolver = uploadLocationResolver; }
protected TwitterController GetTwitterController(Container container = null, ISessionAdapter session = null) { return(new TwitterController(container, session) { ControllerContext = new ControllerContext() }); }
public RestModule( ICacheAdapter appCache, ISessionAdapter session, IResponseAdapter response) { this.Application = appCache; this.Session = session; this.Response = response; }
public static bool IsSessionAuthenticated(ISessionAdapter session) { bool isAuthenticated = false; if (session["Authenticated"] != null) { isAuthenticated = (bool)session["Authenticated"]; } return isAuthenticated; }
public static bool IsSessionAdminAuthenticated(ISessionAdapter session) { bool isAdminAuthenticated = false; if (session["Authenticated"] != null && session["OpsLevel"] != null) { isAdminAuthenticated = (bool)session["Authenticated"] && (bool)session["OpsLevel"]; } return(isAdminAuthenticated); }
public TimeApprovalController(ITimeApprovalService timeApprovalService, IApproveTimeCommand approveTimeCommand, IWeekOfTimeEntriesQuery weekOfTimeEntriesQuery, ITimeApprovalListQuery timeApprovalListQuery, ISessionAdapter sessionAdapter) { this.timeApprovalService = timeApprovalService; this.approveTimeCommand = approveTimeCommand; this.weekOfTimeEntriesQuery = weekOfTimeEntriesQuery; this.timeApprovalListQuery = timeApprovalListQuery; this.sessionAdapter = sessionAdapter; }
public JobsController(IClientsRepository clientRepository, IJobsRepository jobsRepository, IEmployeeRepository employeeRepository, ISitesRepository siteRepository, ITimeService timeService, ISessionAdapter sessionAdapter, IMapper mapper) { this.clientRepository = clientRepository; this._jobsRepository = jobsRepository; this._employeeRepository = employeeRepository; this.siteRepository = siteRepository; this.timeService = timeService; this.sessionAdapter = sessionAdapter; _mapper = mapper; }
public static bool ValidateJSONRequestHasAuthenticatedSession( ISessionAdapter session, out string error_code) { bool success = true; error_code = SuccessMessages.GENERAL_SUCCESS; if (!IsSessionAuthenticated(session)) { error_code = ErrorMessages.NOT_AUTHENTICATED; success = false; } return success; }
public static bool ValidateJSONRequestHasAuthenticatedSession( ISessionAdapter session, out string error_code) { bool success = true; error_code = SuccessMessages.GENERAL_SUCCESS; if (!IsSessionAuthenticated(session)) { error_code = ErrorMessages.NOT_AUTHENTICATED; success = false; } return(success); }
public static bool ValidateJSONRequestSessionOwnsCharacter( ISessionAdapter session, int characterId, out string error_code) { bool success = true; error_code = SuccessMessages.GENERAL_SUCCESS; if (!VerifySessionOwnsCharacter(session, characterId)) { error_code = ErrorMessages.INVALID_REQUEST; success = false; } return(success); }
public static bool ValidateJSONRequestSessionLoggedInAsUser( ISessionAdapter session, string username, out string error_code) { bool success = true; error_code = SuccessMessages.GENERAL_SUCCESS; if (GetSessionUsername(session) != username) { error_code = ErrorMessages.NOT_LOGGED_IN; success = false; } return(success); }
public Specification when_updating_status_with_no_access_token() { const string statusText = "some test status"; var statusViewModel = new StatusViewModel { Status = statusText }; ISessionAdapter session = sessionFactory(); return(new QuerySpecification <TwitterController, ActionResult> { On = () => GetTwitterController(session: session), When = ctrl => ctrl.UpdateStatus(statusViewModel), Expect = { actionResult => session.GetTwitterNewStatus() == statusText, actionResult => actionResult is RedirectToRouteResult, actionResult => ((RedirectToRouteResult)actionResult).RouteValues["action"] == "SignIn", }, }); }
public TimeEntryController(//IWeekService weekService, ICopyPreviousWeekTimeCommand copyPreviousWeekTimeCommand, ISaveTimeEntriesCommand saveTimeEntriesCommand, IAddNewJobTaskComboCommand addNewJobTaskComboCommand, IWeekOfTimeEntriesQuery weekOfTimeEntriesQuery, IWeekIdentifierListQuery weekIdentifierListQuery, IApproveTimeCommand approveTimeCommand, IRemoveRowCommand removeRowCommand, IModifyJobTaskComboCommand modifyJobTaskComboCommand, ISessionAdapter sessionAdapter, IExpenseService expenseService) { //this.weekService = weekService; this.copyPreviousWeekTimeCommand = copyPreviousWeekTimeCommand; this.saveTimeEntriesCommand = saveTimeEntriesCommand; this.addNewJobTaskComboCommand = addNewJobTaskComboCommand; this.weekOfTimeEntriesQuery = weekOfTimeEntriesQuery; this.weekIdentifierListQuery = weekIdentifierListQuery; this.approveTimeCommand = approveTimeCommand; this.removeRowCommand = removeRowCommand; this.modifyJobTaskComboCommand = modifyJobTaskComboCommand; this.sessionAdapter = sessionAdapter; _expenseService = expenseService; }
public static OAuthToken GetTwitterAccessToken(this ISessionAdapter obj) { return(obj.GetValueOrEmpty <OAuthToken>(AccessTokenCode)); }
public TimeController(ISessionAdapter sessionAdapter, ISaveTimeEntriesCommand saveTimeEntriesCommand, IWeekOfTimeEntriesQuery weekOfTimeEntriesQuery) { _sessionAdapter = sessionAdapter; _saveTimeEntriesCommand = saveTimeEntriesCommand; _weekOfTimeEntriesQuery = weekOfTimeEntriesQuery; }
public FindOrCreateRevisionPublisher(ISessionAdapter sessionAdapter, RevisionFactory factory, IRepository api) { _sessionAdapter = sessionAdapter; _factory = factory; _api = api; }
public FindOrCreateReviewPublisher(ISessionAdapter sessionAdapter, [CurrentUser] ReviewUser user) { _sessionAdapter = sessionAdapter; _user = user; }
//ctor for mocking internal BaseController(Container container, ISessionAdapter sessionAdapter) { _container = new Lazy<Container>(() => container); _sessionAdapter = new Lazy<ISessionAdapter>(() => sessionAdapter); }
public static void SetTwitterStatus(this ISessionAdapter obj, string value) { obj.SetValue(StatusCode, value); }
public static bool VerifySessionOwnsCharacter(ISessionAdapter session, int character_id) { int[] characters_ids = (int[])session["CharacterIDs"]; bool sessionOwnsCharacter = characters_ids.Contains(character_id); return sessionOwnsCharacter; }
public FileDiscussionsPublisher(ISessionAdapter sessionAdapter, FindReviewDelegate reviewForRevision, Func <ClientFileId, Guid> resolveFileId) { _sessionAdapter = sessionAdapter; _reviewForRevision = reviewForRevision; _resolveFileId = resolveFileId; }
public static void SetTwitterAccessToken(this ISessionAdapter obj, OAuthToken value) { obj.SetValue(AccessTokenCode, value); }
public static string GetSessionUsername(ISessionAdapter session) { return (string)session["Username"]; }
internal TwitterController(Container container, ISessionAdapter sessionAdapter) : base(container, sessionAdapter) { }
public static string GetTwitterNewStatus(this ISessionAdapter obj) { return(obj.GetValueOrEmpty <string>(StatusCode)); }
public static bool ValidateJSONRequestSessionLoggedInAsUser( ISessionAdapter session, string username, out string error_code) { bool success = true; error_code = SuccessMessages.GENERAL_SUCCESS; if (GetSessionUsername(session) != username) { error_code = ErrorMessages.NOT_LOGGED_IN; success = false; } return success; }
public static bool ValidateJSONRequestSessionOwnsCharacter( ISessionAdapter session, int characterId, out string error_code) { bool success = true; error_code = SuccessMessages.GENERAL_SUCCESS; if (!VerifySessionOwnsCharacter(session, characterId)) { error_code = ErrorMessages.INVALID_REQUEST; success = false; } return success; }
public static int GetSessionAccountID(ISessionAdapter session) { return (int)session["AccountId"]; }
public ShoppingCartService(ITicketsService ticketsService, ISessionAdapter sessionAdapter) { this.ticketsService = ticketsService; this.sessionAdapter = sessionAdapter; }