Exemplo n.º 1
0
        public void Components()
        {
            ISession     s;
            ITransaction tx;

            s  = OpenSession();
            tx = s.BeginTransaction();
            Martian martian = new Martian();

            martian.Id      = new MartianPk("Liberal", "Biboudie");
            martian.Address = new MarsAddress("Plus", "cont");
            s.Save(martian);
            try
            {
                s.Flush();
                Assert.Fail("Components are not validated");
            }
            catch (InvalidStateException e)
            {
                e.InvalidValues.Should().Have.Count.EqualTo(2);
            }
            finally
            {
                tx.Rollback();
                s.Close();
            }
        }
Exemplo n.º 2
0
 public void Components()
 {
     ISession s;
     ITransaction tx;
     s = OpenSession();
     tx = s.BeginTransaction();
     Martian martian = new Martian();
     martian.Id = new MartianPk("Liberal", "Biboudie");
     martian.Address = new MarsAddress("Plus", "cont");
     s.Save(martian);
     try
     {
         s.Flush();
         Assert.Fail("Components are not validated");
     }
     catch (InvalidStateException e)
     {
         e.GetInvalidValues().Should().Have.Count.EqualTo(2);
     }
     finally
     {
         tx.Rollback();
         s.Close();
     }
 }