public void OrdersExtract()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar));
			
			storage.ServerName = "NEON-64";
			storage.DatabaseName = "Northwind";

			storage.SelectSql = "SELECT * FROM Orders";
			storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);

			OrdersVerticalBar[] res = null;

			try
			{
				res = storage.ExtractRecords() as OrdersVerticalBar[];
			}
			catch(SqlException ex)
			{
				if (ex.Number == 208)
					Assert.Ignore("You dont have this tables in your SqlServer");

				if (ex.Number == 6)
					Assert.Ignore("SqlServer not found, skipping this test.");

				Assert.Ignore(ex.ToString());
			}

			Assert.AreEqual(830, res.Length);

			Assert.AreEqual("VINET", res[0].CustomerID);
			Assert.AreEqual("TOMSP", res[1].CustomerID);
			Assert.AreEqual("HANAR", res[2].CustomerID);
		}
		public void OrdersExtractToFile()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar));
			
			storage.ServerName = "NEON-64";
			storage.DatabaseName = "Northwind";

			storage.SelectSql = "SELECT * FROM Orders";
			storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);

			try
			{
				FileDataLink.EasyExtractToFile(storage, "tempord.txt");
			}
			catch(SqlException ex)
			{
				if (ex.Number == 208)
					Assert.Ignore("You dont have this tables in your SqlServer");

				if (ex.Number == 6)
					Assert.Ignore("SqlServer not found, skipping this test.");

				Assert.Ignore(ex.ToString());
			}


			FileDataLink link = new FileDataLink(storage);
			link.ExtractToFile("tempord.txt");

			OrdersVerticalBar[] res = CommonEngine.ReadFile(typeof(OrdersVerticalBar), "tempord.txt") as OrdersVerticalBar[];

			if (File.Exists("tempord.txt")) File.Delete("tempord.txt");

			Assert.AreEqual(830, res.Length);

			Assert.AreEqual("VINET", res[0].CustomerID);
			Assert.AreEqual("TOMSP", res[1].CustomerID);
			Assert.AreEqual("HANAR", res[2].CustomerID);
		}
        public void CustomersInsertEasy()
        {
            var storage = new SqlServerStorage(typeof (CustomersVerticalBar));

            storage.ServerName = "NEON-64";
            storage.DatabaseName = "Northwind";

            storage.InsertSqlCallback = new InsertSqlHandler(GetInsertSqlCust);

            try {
                FileDataLink.EasyInsertFromFile(storage, TestCommon.GetPath("Good", "CustomersVerticalBar.txt"));
            }
            catch (SqlException ex) {
                if (ex.Number == 208)
                    Assert.Ignore("You dont have this tables in your SqlServer");

                if (ex.Number == 6)
                    Assert.Ignore("SqlServer not found, skipping this test.");

                Assert.Ignore(ex.ToString());
            }
        }
		public void OrdersInsertBad()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar));
			
			storage.ServerName = "NEON-64";
			storage.DatabaseName = "Northwind";

			storage.InsertSqlCallback = new InsertSqlHandler(GetInsertSqlOrder);
			OrdersVerticalBar[] res = (OrdersVerticalBar[]) CommonEngine.ReadFile(typeof(OrdersVerticalBar), Common.TestPath(@"Good\OrdersVerticalBar.txt"));
			OrdersVerticalBar[] res2 = new OrdersVerticalBar[1];
			res2[0] = res[0];

			//storage.ExecuteInBatchSize
			//res2[0].OrderDate = new DateTime(1750, 10, 10);
			try
			{
				storage.InsertRecords(res2);
			}
			catch(SqlException ex)
			{
				if (ex.Number == 208)
					Assert.Ignore("You dont have this tables in your SqlServer");

				if (ex.Number == 6)
					Assert.Ignore("SqlServer not found, skipping this test.");

				Assert.Ignore(ex.ToString());
			}

		}
		public void CustomerInsert()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(CustomersVerticalBar));
			
			storage.ServerName = "NEON-64";
			storage.DatabaseName = "Northwind";

			storage.InsertSqlCallback = new InsertSqlHandler(GetInsertSqlCust);

			try
			{
				storage.InsertRecords(CommonEngine.ReadFile(typeof(CustomersVerticalBar), Common.TestPath(@"Good\CustomersVerticalBar.txt")));
			}
			catch(SqlException ex)
			{
				if (ex.Number == 208)
					Assert.Ignore("You dont have this tables in your SqlServer");

				if (ex.Number == 6)
					Assert.Ignore("SqlServer not found, skipping this test.");

				Assert.Ignore(ex.ToString());
			}


		}
		public void OrdersExtractBad5()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar), "WhereIsThisServer", "Northwind");
			
			storage.SelectSql = "SELECT TOP 100 * FROM Orders";

			storage.ExtractRecords();
		}
		public void OrdersExtractBad4()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar), "NEON-64", "SureThatThisDontExist");
			
			storage.SelectSql = "SELECT TOP 100 * FROM Orders";

			storage.ExtractRecords();
		}
		public void OrdersExtractBad3()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar), "NEON-64", "Northwind");
			
			storage.SelectSql = "SELECT TOP 100 * FROM Orders";

			try
			{
				storage.ExtractRecords();
			}
			catch(SqlException ex)
			{
				if (ex.Number == 208)
					Assert.Ignore("You dont have this tables in your SqlServer");

				if (ex.Number == 6)
					Assert.Ignore("SqlServer not found, skipping this test.");

				Assert.Ignore(ex.ToString());
			}
		}
		public void OrdersExtractBad2()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar));
			
			storage.SelectSql = "SELECT TOP 100 * FROM Orders";
			storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);

			storage.ExtractRecords();
		}
		public void OrdersExtractBad1()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar), "NEON-64", "Northwind");
			
			storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);
			storage.ExtractRecords();
		}
        public void OrdersExtractBad5()
        {
            var storage = new SqlServerStorage(typeof (OrdersVerticalBar), "WhereIsThisServer", "Northwind");

            storage.SelectSql = "SELECT TOP 100 * FROM Orders";

            Assert.Throws<SqlException>(()
                => storage.ExtractRecords());
        }
        public void OrdersExtractBad4()
        {
            var storage = new SqlServerStorage(typeof (OrdersVerticalBar), "NEON-64", "SureThatThisDontExist");

            storage.SelectSql = "SELECT TOP 100 * FROM Orders";


            Assert.Throws<SqlException>(()
                => storage.ExtractRecords());
        }
        public void OrdersExtractBad2()
        {
            var storage = new SqlServerStorage(typeof (OrdersVerticalBar));

            storage.SelectSql = "SELECT TOP 100 * FROM Orders";
            storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);

            Assert.Throws<BadUsageException>(()
                => storage.ExtractRecords());
        }
        public void OrdersExtractBad1()
        {
            var storage = new SqlServerStorage(typeof (OrdersVerticalBar), "NEON-64", "Northwind");

            storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);

            Assert.Throws<BadUsageException>(()
                => storage.ExtractRecords());
        }