public void EndEndedSessionTest2()
        {
            var dateTimeProvider     = new DebugDateTimeProvider();
            var storedSessionManager = new StoredSessionManager(dateTimeProvider);
            var leaseLength          = TimeSpan.FromSeconds(1);
            var key           = "mysession";
            var leaseEnd      = dateTimeProvider.CurrentTime + leaseLength;
            var storedSession = storedSessionManager.Begin(key, leaseEnd);

            // End the session
            storedSession = storedSessionManager.End(storedSession);

            // The session is already ended => This shouls be a nop
            storedSession = storedSessionManager.End(storedSession);

            Assert.AreEqual(2, storedSession.StorageVersion);
            Assert.IsTrue(storedSessionManager.IsEnded(storedSession));
        }
        public void EndTest()
        {
            var dateTimeProvider     = new DebugDateTimeProvider();
            var storedSessionManager = new StoredSessionManager(dateTimeProvider);
            var leaseLength          = TimeSpan.FromSeconds(1);
            var key           = "mysession";
            var leaseEnd      = dateTimeProvider.CurrentTime + leaseLength;
            var storedSession = storedSessionManager.Begin(key, leaseEnd);

            storedSession = storedSessionManager.End(storedSession);

            Assert.AreEqual(key, storedSession.Key);
            Assert.AreEqual(leaseEnd, storedSession.LeaseEnd);
            Assert.AreEqual(2, storedSession.StorageVersion);
            Assert.IsNotNull(storedSession.EntryPaths);
            Assert.AreEqual(0, storedSession.EntryPaths.Count());
            Assert.IsTrue(storedSessionManager.IsEnded(storedSession));
        }