Ejemplo n.º 1
0
        public void OrdersInsertBad()
        {
            var storage = new SqlServerStorage(typeof(OrdersVerticalBar));

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

            storage.InsertSqlCallback = new InsertSqlHandler(GetInsertSqlOrder);
            var res =
                (OrdersVerticalBar[])
                CommonEngine.ReadFile(typeof(OrdersVerticalBar),
                                      TestCommon.GetPath("Good", "OrdersVerticalBar.txt"));
            var 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());
            }
        }
Ejemplo n.º 2
0
        protected string GetInsertSqlOrder(object record)
        {
            OrdersVerticalBar obj = (OrdersVerticalBar)record;

            return(String.Format("INSERT INTO OrdersTemp (CustomerId, OrderDate) " +
                                 " VALUES ('{0}' , '{1}'); ",
                                 obj.CustomerID,
                                 obj.OrderDate.ToShortDateString()
                                 ));
        }
Ejemplo n.º 3
0
        protected void FillRecordOrder(object rec, object[] fields)
        {
            OrdersVerticalBar record = (OrdersVerticalBar)rec;

            record.OrderID      = (int)fields[0];
            record.CustomerID   = (string)fields[1];
            record.EmployeeID   = (int)fields[2];
            record.OrderDate    = (DateTime)fields[3];
            record.RequiredDate = (DateTime)fields[4];
            if (fields[5] != DBNull.Value)
            {
                record.ShippedDate = (DateTime)fields[5];
            }
            else
            {
                record.ShippedDate = DateTime.MinValue;
            }
            record.ShipVia = (int)fields[6];
            record.Freight = (decimal)fields[7];
        }
Ejemplo n.º 4
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());
			}

		}