Exemplo n.º 1
0
        private void AssertJuanPerezWasImportedCorrectly()
        {
            var juanPerez = _system.CustomerIdentifiedAs("C", "23-25666777-9");

            AssertCustomer(juanPerez, "Juan", "Perez", "C", "23-25666777-9", 1);
            AssertAddressAt(juanPerez, "Alem", 1122, "CABA", 1001, "CABA");
        }
Exemplo n.º 2
0
        public void Test3()
        {
            // 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\n"))
                {
                    try
                    {
                        var transaction = _persistentCustomerSystem._session.BeginTransaction();
                        new CustomerImporter(_persistentCustomerSystem._session, inputStream).Value();

                        transaction.Commit();

                        throw new ImportException("Test Failed");
                    }
                    catch (ImportException ex)
                    {
                        Assert.AreEqual("Could not import Address. Data is missing", ex.Message);
                        Assert.AreEqual(1, _persistentCustomerSystem._session.CreateCriteria <Customer>().List <Customer>().Count);
                        var customer = _persistentCustomerSystem.CustomerIdentifiedAs("D", "22333444");
                        Assert.AreEqual(0, customer.Addresses.Count);
                    }
                }
        }
        public Customer CustomerIdentifiedAs(string anIdentificationType, string anIdentificationNumber)
        {
            _customerSystem = new PersistentCustomerSystem(_session);

            return(_customerSystem.CustomerIdentifiedAs(anIdentificationType, anIdentificationNumber));
        }