Exemple #1
0
        public void AddTest()
        {
            Fabricante item = new Fabricante()
            {
                Nome = "Fabricante01"
            };
            IProducerRepository target = new ProducerRepository();

            target.Add(item);

            try
            {
                // use session to try to load the product
                using (ISession session = NHibernateHelper.OpenSession())
                {
                    var fromDb = session.Get <Fabricante>(item.Id);

                    Assert.IsNotNull(fromDb);
                    Assert.AreNotSame(item, fromDb);
                    Assert.AreEqual(item.Nome, fromDb.Nome);
                }
            }
            finally
            {
                target.Remove(item);
            }
        }
Exemple #2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            item = new Fabricante()
            {
                Nome = "Fabricante01"
            };
            IProducerRepository target = new ProducerRepository();

            target.Add(item);
        }