Пример #1
0
        public void CustomerInsert()
        {
            var storage = new SqlServerStorage(typeof (CustomersVerticalBar));

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

            storage.InsertSqlCallback = new InsertSqlHandler(GetInsertSqlCust);

            try {
                storage.InsertRecords(CommonEngine.ReadFile(typeof (CustomersVerticalBar),
                    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());
            }
        }
Пример #2
0
		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());
			}

		}