public void Update(MagicColor magiccolor)
 {
     using (var session = NHibernateHelper.OpenSession())
     using (var transaction = session.BeginTransaction())
     {
         session.Update(magiccolor);
         transaction.Commit();
     }
 }
        public void CanAddColor()
        {
            var color = new MagicColor {Name = "Green", ShortName = "G"};
            IMagicColorsRepository repository = new MagicColorsRepository();
            repository.Add(color);

            // use session to try to load the product);
            using (ISession session = _sessionFactory.OpenSession())
            {
                var fromDb = session.Get<MagicColor>(color.Id);

                // Test that the color was successfully inserted
                Assert.IsNotNull(fromDb);
                Assert.AreNotSame(color, fromDb);
                Assert.AreEqual(color.Name, fromDb.Name);
                Assert.AreEqual(color.ShortName, fromDb.ShortName);
            }
        }