public async Task AddSessionTest() { var sessionCount = Context.Session.Count(); await _sessionDataProvider.Add(1); Assert.AreEqual(sessionCount + 1, Context.Session.Count()); }
/// <summary> /// Adds Session Synchronously. Use it when you want application to add Value Synchronously. /// </summary> /// <param name="category">The category under which the object is stored.</param> /// <param name="sessionId">The key against which the object is stored in the category.</param> /// <param name="value">Value that needs to be added to DataStore</param> /// <param name="expiresOn">Expiration TimeSpan</param> public void Add(string category, string sessionId, object value, TimeSpan expiresOn) { try { _provider.Add(category, sessionId, value, expiresOn); } catch (SessionException) { throw; } catch (Exception ex) { throw new SessionException(SessionResources.Error_Generic, ex); } }