public Session Add(Session session)
 {
     return AddOrUpdate<Session>("mm_Sessions_Create", new {
         UserID = session.User_UserID, // We must allow this to be passed in or login cannot work...
         Key = session.Key,
         Expiry = session.Expiry
     });
 }
 public Session Update(Session session)
 {
     return AddOrUpdate<Session>("mm_Sessions_Update", new {
         UserID = _userId,
         SessionID = session.SessionID,
         Key = session.Key,
         Expiry = session.Expiry
     });
 }
        public void Data_Create_Session()
        {
            var repository = new SessionRepository(_dataConnectionString, 1);

            var session = new MABMoney.Domain.Session {
                User_UserID = 1,
                Key = "ADDED",
                Expiry = new DateTime(2020, 1, 1)
            };

            var result = repository.Add(session);

            Assert.IsTrue(result.SessionID == 5);
            Assert.IsTrue(result.User_UserID == 1);
            Assert.IsTrue(result.Key == "ADDED");
            Assert.IsTrue(result.Expiry.Date == new DateTime(2020, 1, 1).Date);
            Assert.IsTrue(result.CreatedBy == 1);
            Assert.IsTrue(result.CreatedDate.Date == DateTime.Now.Date);
            Assert.IsTrue(result.LastModifiedBy == 1);
            Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date);
        }