public void WhenReadingFileAndInsertingInDbWeGet245() { var repo = new Repository <Country>(session); var parser = new CsvCountrieFileParser(); var target = new CsvFileToDbTransformer(parser, repo); target.Execute(@"Countries.csv"); var count = repo.GetAll().Count; Assert.AreEqual(245, count); }
public void Initialize() { sessionFactory = new NhConfig(connectionString).Create(); session = sessionFactory.OpenSession(); using (var command = session.Connection.CreateCommand()) { command.CommandText = "delete Country"; command.ExecuteNonQuery(); } var repo = new Repository <Country>(session); var parser = new CsvCountrieFileParser(); var target = new CsvFileToDbTransformer(parser, repo); target.Execute(@"Countries.csv"); }
public void WhenReadingFileAndInsertingInDbWeGet245() { var repository = new ProductService(session); IList <Product> products = new List <Product>(); Product product = new Product(); product.Id = 5; product.Name = "Bors"; product.ListPrice = 200; products.Add(product); // var parser = new CsvCountrieFileParser(); var target = new CsvFileToDbTransformer(repository, products); target.Execute(); // target.Execute(@"Countries.csv"); var count = repository.GetAll().Count; Assert.AreEqual(1, count); }