public async Task OneEmployeeAndOrder_OrderBeforeRange_ReturnNothing()
        {
            EmployeesTemplate employee = await TestRunner.InsertTemplateAsync(new EmployeesTemplate()
                                                                              .WithFirstName("Jamie")
                                                                              .WithLastName("Burns")
                                                                              .WithCountry("UK"));

            await TestRunner.InsertTemplateAsync(new OrdersTemplate()
                                                 .WithEmployeeID(employee.Identity)
                                                 .WithOrderID(1001)
                                                 .WithShippedDate(DateTime.Parse("05-Mar-2019")));

            var product = await TestRunner.InsertTemplateAsync <ProductsTemplate>();

            await TestRunner.InsertTemplateAsync(new Order_DetailsTemplate()
                                                 .WithOrderID(1001)
                                                 .WithProductID(product.Identity)
                                                 .WithUnitPrice(10)
                                                 .WithQuantity(5)
                                                 .WithDiscount(0));

            QueryResult data = await TestRunner.ExecuteStoredProcedureQueryAsync("dbo.[Employee Sales by Country]",
                                                                                 new SqlQueryParameter("Beginning_Date", DateTime.Parse("01-Mar-2020")),
                                                                                 new SqlQueryParameter("Ending_Date", DateTime.Parse("10-Mar-2020"))
                                                                                 );

            data
            .AssertRowCount(0);
        }
Esempio n. 2
0
        public async Task Templates_CanAllBeAdded()
        {
            await TestRunner.InsertTemplateAsync <CategoriesTemplate>();

            await TestRunner.InsertTemplateAsync(new CustomersTemplate().WithCustomerID("Cust1"));

            await TestRunner.InsertTemplateAsync(new CustomerDemographicsTemplate().WithCustomerTypeID("Type1"));

            await TestRunner.InsertTemplateAsync(new CustomerCustomerDemoTemplate().WithCustomerID("Cust1").WithCustomerTypeID("Type1"));

            EmployeesTemplate employee = await TestRunner.InsertTemplateAsync(new EmployeesTemplate());

            RegionTemplate region = await TestRunner.InsertTemplateAsync <RegionTemplate>();

            await TestRunner.InsertTemplateAsync(new TerritoriesTemplate().WithTerritoryID("Terry1").WithRegionID((int)region.MergedData["RegionID"]));

            await TestRunner.InsertTemplateAsync(new EmployeeTerritoriesTemplate()
                                                 .WithEmployeeID(employee.IdentityResolver)
                                                 .WithTerritoryID("Terry1")
                                                 );

            await TestRunner.InsertTemplateAsync(new ProductsTemplate().WithProductID(3001));

            await TestRunner.InsertTemplateAsync(new OrdersTemplate().WithOrderID(2001));

            await TestRunner.InsertTemplateAsync(new Order_DetailsTemplate().WithOrderID(2001).WithProductID(3001));

            await TestRunner.InsertTemplateAsync <ShippersTemplate>();

            await TestRunner.InsertTemplateAsync <SuppliersTemplate>();
        }
        public async Task OneEmployeesAndTwoOrders_ReturnTwoRows()
        {
            EmployeesTemplate employee = await TestRunner.InsertTemplateAsync(new EmployeesTemplate()
                                                                              .WithFirstName("Jamie")
                                                                              .WithLastName("Burns")
                                                                              .WithCountry("UK"));

            await TestRunner.InsertTemplateAsync(new OrdersTemplate()
                                                 .WithEmployeeID(employee.Identity)
                                                 .WithOrderID(1001)
                                                 .WithShippedDate(DateTime.Parse("05-Mar-2020")));

            await TestRunner.InsertTemplateAsync(new OrdersTemplate()
                                                 .WithEmployeeID(employee.Identity)
                                                 .WithOrderID(1002)
                                                 .WithShippedDate(DateTime.Parse("06-Mar-2020")));

            var product = await TestRunner.InsertTemplateAsync <ProductsTemplate>();

            await TestRunner.InsertTemplateAsync(new Order_DetailsTemplate()
                                                 .WithOrderID(1001)
                                                 .WithProductID(product.Identity)
                                                 .WithUnitPrice(10)
                                                 .WithQuantity(5)
                                                 .WithDiscount(0));

            await TestRunner.InsertTemplateAsync(new Order_DetailsTemplate()
                                                 .WithOrderID(1002)
                                                 .WithProductID(product.Identity)
                                                 .WithUnitPrice(20)
                                                 .WithQuantity(5)
                                                 .WithDiscount(0));

            QueryResult data = await TestRunner.ExecuteStoredProcedureQueryAsync("dbo.[Employee Sales by Country]",
                                                                                 new SqlQueryParameter("Beginning_Date", DateTime.Parse("01-Mar-2020")),
                                                                                 new SqlQueryParameter("Ending_Date", DateTime.Parse("10-Mar-2020"))
                                                                                 );

            data
            .AssertRowCount(2)
            .AssertRowValues(0, new DataSetRow
            {
                { "Country", "UK" },
                { "LastName", "Burns" },
                { "FirstName", "Jamie" },
                { "ShippedDate", DateTime.Parse("05-Mar-2020") },
                { "OrderID", 1001 },
                { "SaleAmount", 50m }
            })
            .AssertRowValues(1, new DataSetRow
            {
                { "Country", "UK" },
                { "LastName", "Burns" },
                { "FirstName", "Jamie" },
                { "ShippedDate", DateTime.Parse("06-Mar-2020") },
                { "OrderID", 1002 },
                { "SaleAmount", 100m }
            });
        }