Exemplo n.º 1
0
        public void TestImportValidData()
        {
            // Bad Smell 4: Que el test conozca como conectarse!
            using (_system._session = _system.CreateSession())
                using (var inputStream = ValidDataStream())
                {
                    var transaction = _system._session.BeginTransaction();
                    new CustomerImporter(_system._session, inputStream).Value();

                    Assert.AreEqual(2, _system._session.CreateCriteria <Customer>().List <Customer>().Count);

                    AssertPepeSanchezWasImportedCorrectly();
                    AssertJuanPerezWasImportedCorrectly();

                    transaction.Commit();
                }
        }
Exemplo n.º 2
0
        public void Test1()
        {
            // Bad Smell 4: Que el test conozca como conectarse!
            using (_persistentCustomerSystem._session = _persistentCustomerSystem.CreateSession())
                using (var inputStream = ValidDataStream("C,Pepe,Sanchez,D,22333444\n" +
                                                         "A,San Martin,3322,Olivos,1636,BsAs\n" +
                                                         "A,Maipu,888,Florida,1122,Buenos Aires\n" +
                                                         "C,Juan,Perez,C,23-25666777-9\n" +
                                                         "A,Alem,1122,CABA,1001,CABA"))
                {
                    var transaction = _persistentCustomerSystem._session.BeginTransaction();
                    new CustomerImporter(_persistentCustomerSystem._session, inputStream).Value();

                    Assert.AreEqual(2, _persistentCustomerSystem._session.CreateCriteria <Customer>().List <Customer>().Count);

                    AssertPepeSanchezWasImportedCorrectly();
                    AssertJuanPerezWasImportedCorrectly();

                    transaction.Commit();
                }
        }