Ejemplo n.º 1
0
        public void ExtractQuery_NonExistingDataSetMoreThanOneExisting_CorrectExceptionReturned()
        {
            var request = new ReportDataSetRequest(
                ConnectionStringReader.GetReportServerDatabase()
                , "/AdventureWorks Sample Reports/"
                , "Currency Rates"
                , "Non Existing"
                );

            var parser = new DatabaseReportingParser();
            var ex     = Assert.Throws <ArgumentException>(() => parser.ExtractCommand(request));

            Assert.That(ex.Message, Does.Contain("DataSet1").And.StringContaining("DataSet2"));
        }
Ejemplo n.º 2
0
        public void ExtractQuery_NonExistingSharedDataSet_CorrectQuery()
        {
            var request = new ReportDataSetRequest(
                ConnectionStringReader.GetReportServerDatabase()
                , "/AdventureWorks Sample Reports/"
                , "Employee_Sales_Summary"
                , "NonExisting"
                );

            var parser = new DatabaseReportingParser();
            var ex     = Assert.Throws <ArgumentException>(() => parser.ExtractCommand(request));

            Assert.That(ex.Message, Does.Contain("Quota").And.StringContaining("EmpSalesMonth"));
        }
Ejemplo n.º 3
0
        public void ExtractQuery_NonExistingReport_CorrectExceptionReturned()
        {
            var request = new ReportDataSetRequest(
                ConnectionStringReader.GetReportServerDatabase()
                , "/AdventureWorks Sample Reports/"
                , "Not Existing"
                , "DataSet1"
                );

            var parser = new DatabaseReportingParser();
            var ex     = Assert.Throws <ArgumentException>(() => parser.ExtractCommand(request));

            Assert.That(ex.Message, Is.StringContaining("No report found"));
        }
Ejemplo n.º 4
0
        public void ExtractQuery_SharedDataSet_CorrectQuery()
        {
            var request = new SharedDatasetRequest(
                ConnectionStringReader.GetReportServerDatabase()
                , "/AdventureWorks Sample Reports/"
                , "EmpSalesMonth"
                );

            var parser = new DatabaseReportingParser();
            var query  = parser.ExtractCommand(request);

            Assert.That(query.Text,
                        Does.Contain("SELECT"));
            Assert.That(query.CommandType, Is.EqualTo(CommandType.Text));
        }
Ejemplo n.º 5
0
        public void ExtractQuery_ExistingReportAndDataSet_CorrectQueryReturned()
        {
            var request = new ReportDataSetRequest(
                ConnectionStringReader.GetReportServerDatabase()
                , "/AdventureWorks Sample Reports/"
                , "Currency_List"
                , "Currency"
                );

            var parser = new DatabaseReportingParser();
            var query  = parser.ExtractCommand(request);

            Assert.That(query.Text,
                        Does.Contain("SELECT").And
                        .StringContaining("[CurrencyAlternateKey]").And
                        .StringContaining("[DimCurrency]"));
            Assert.That(query.CommandType, Is.EqualTo(CommandType.Text));
        }