Exemplo n.º 1
0
		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);
		}
Exemplo n.º 2
0
		public void OrdersExtractBad5()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar), "WhereIsThisServer", "Northwind");
			
			storage.SelectSql = "SELECT TOP 100 * FROM Orders";

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

			storage.ExtractRecords();
		}
Exemplo n.º 4
0
		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());
			}
		}
Exemplo n.º 5
0
		public void OrdersExtractBad2()
		{
			SqlServerStorage storage = new SqlServerStorage(typeof(OrdersVerticalBar));
			
			storage.SelectSql = "SELECT TOP 100 * FROM Orders";
			storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);

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

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

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

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


            Assert.Throws<SqlException>(()
                => storage.ExtractRecords());
        }
Exemplo n.º 9
0
        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());
        }
Exemplo n.º 10
0
        public void OrdersExtractBad1()
        {
            var storage = new SqlServerStorage(typeof (OrdersVerticalBar), "NEON-64", "Northwind");

            storage.FillRecordCallback = new FillRecordHandler(FillRecordOrder);

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