public void CreateNewSession() { using (var session = new PersistentAccumulatorSession()) { Assert.IsNotNull(session, "Session is null"); } }
public void RunSession() { using (var session = new PersistentAccumulatorSession()) { session.Start(); Assert.AreEqual(0, session.Sum, "Incorrect sum"); } }
public void ResumeSession() { using (var session = new PersistentAccumulatorSession()) { session.Start(); session.Suspend(); session.Resume(1); Assert.AreEqual(1, session.Sum, "Incorrect sum"); } }
public string PersistentAccumulate() { try { var session = new PersistentAccumulatorSession(); session.Start(); return session.Application.Id.ToString(); } catch (Exception exception) { OutgoingWebResponseContext response = WebOperationContext.Current.OutgoingResponse; response.StatusCode = HttpStatusCode.Forbidden; response.StatusDescription = exception.Message; return exception.Message; } }
public int PersistentAccumulate(string sessionId, string number) { var session = new PersistentAccumulatorSession(sessionId); session.Resume(int.Parse(number)); return session.Completed ? 0 : session.Sum; }