From d000041e21e3f2616effe9c22f172a2b6bcfff7e Mon Sep 17 00:00:00 2001 From: Jakub Raczek Date: Wed, 10 Feb 2021 18:33:18 +0100 Subject: [PATCH] Add Product.xml test --- .../key_comparator/Product/Product.xml | 20 +++++++++++++++++++ .../key_comparator/Product/create.sql | 9 +++++++++ .../key_comparator/Product/drop.sql | 1 + .../key_comparator/Product/insert.sql | 12 +++++++++++ .../key_comparator/Product/product.csv | 5 +++++ .../key_comparator/Product/product.sql | 8 ++++++++ 6 files changed, 55 insertions(+) create mode 100644 test-definitions/key_comparator/Product/Product.xml create mode 100644 test-definitions/key_comparator/Product/create.sql create mode 100644 test-definitions/key_comparator/Product/drop.sql create mode 100644 test-definitions/key_comparator/Product/insert.sql create mode 100644 test-definitions/key_comparator/Product/product.csv create mode 100644 test-definitions/key_comparator/Product/product.sql diff --git a/test-definitions/key_comparator/Product/Product.xml b/test-definitions/key_comparator/Product/Product.xml new file mode 100644 index 0000000..da5b178 --- /dev/null +++ b/test-definitions/key_comparator/Product/Product.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + REMOVE_LEADING_ZEROS + + + NOT_EQUALS + DATE + SUM_INTEGERS + + + + \ No newline at end of file diff --git a/test-definitions/key_comparator/Product/create.sql b/test-definitions/key_comparator/Product/create.sql new file mode 100644 index 0000000..396f30b --- /dev/null +++ b/test-definitions/key_comparator/Product/create.sql @@ -0,0 +1,9 @@ +CREATE TABLE [dbo].[TemplateKeyComparatorProducts]( + [StoreNumber] [int] NOT NULL, + [ProductID] [int] NULL, + [Date] [date] NOT NULL, + [Quantity] [int] NOT NULL) + + + + \ No newline at end of file diff --git a/test-definitions/key_comparator/Product/drop.sql b/test-definitions/key_comparator/Product/drop.sql new file mode 100644 index 0000000..561ebc2 --- /dev/null +++ b/test-definitions/key_comparator/Product/drop.sql @@ -0,0 +1 @@ +drop table [dbo].[TemplateKeyComparatorProducts] \ No newline at end of file diff --git a/test-definitions/key_comparator/Product/insert.sql b/test-definitions/key_comparator/Product/insert.sql new file mode 100644 index 0000000..d6d0f08 --- /dev/null +++ b/test-definitions/key_comparator/Product/insert.sql @@ -0,0 +1,12 @@ + +INSERT INTO [dbo].[TemplateKeyComparatorProducts] + ([StoreNumber] + ,[ProductID] + ,[Date] + ,[Quantity]) + VALUES + (11,123 ,'2020-09-09',300), + (12,124 ,'2020-09-10',400) + + + diff --git a/test-definitions/key_comparator/Product/product.csv b/test-definitions/key_comparator/Product/product.csv new file mode 100644 index 0000000..8d8398c --- /dev/null +++ b/test-definitions/key_comparator/Product/product.csv @@ -0,0 +1,5 @@ +TestSet;Store;Product;Date;Qty +1;11;00123;2020-09-08;100 +1;11;00123;2020-09-09;200 +2;12;00124;2020-09-08;200 +2;12;00124;2020-09-10;200 \ No newline at end of file diff --git a/test-definitions/key_comparator/Product/product.sql b/test-definitions/key_comparator/Product/product.sql new file mode 100644 index 0000000..7b5da1f --- /dev/null +++ b/test-definitions/key_comparator/Product/product.sql @@ -0,0 +1,8 @@ + SELECT + pr.[StoreNumber] + ,pr.ProductID + ,pr.[Date] + ,sum(pr.[Quantity]) + FROM [dbo].[TemplateKeyComparatorProducts] pr + inner join AdventureWorks2008R2.dbo.TemplateKeyComparatorCheckAggregators d on d.[StoreNumber]=pr.[StoreNumber] and d.ProductID=pr.ProductID + group by pr.[StoreNumber],pr.ProductID,pr.Date \ No newline at end of file