示例#1
0
        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);
        }
示例#2
0
        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");
        }
示例#3
0
        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);
        }