コード例 #1
0
		public UserSessionManagerTests()
		{
			stubSession = new UserSession
			{
				UserId = 11,
				Token = "test_token"
			};
		}
コード例 #2
0
		/// <summary>
		/// Saves session created from userId and accessToken to database.
		/// </summary>
		/// <param name="userId">BetterSalesman user identifier in BetterSalesman database (session and business data are stored in separate databases).</param>
		/// <param name="accessToken">Access token for BetterSalesman service.</param>
		public void SaveSession(int userId, string accessToken)
		{
			if (string.IsNullOrEmpty(accessToken))
			{
				Debug.WriteLine("ERROR! Save session requires accessToken to be non-null. Cancelling saving session.");
				return;
			}

			CurrentSession = new UserSession
			{
				UserId = userId,
				Token = accessToken
			};

			Save();
		}