コード例 #1
0
        public IQuery Execute()
        {
            var parser = factory.Instantiate(args.Source);

            var request = new ReportDataSetRequest(args.Source, args.Path, args.Name, args.DataSetName);

            var reportParsingResult = parser.ExtractCommand(request);

            var query = new Query(reportParsingResult.Text, args.ConnectionString, args.Timeout, args.Parameters, args.Variables, reportParsingResult.CommandType);

            return(query);
        }
コード例 #2
0
        public IDbCommand Execute()
        {
            var parser = factory.Instantiate(args.Source);

            var request = new ReportDataSetRequest(args.Source, args.Path, args.Name, args.DataSetName);

            var reportParsingResult = parser.ExtractCommand(request);

            var commandBuilder = new CommandBuilder();
            var cmd            = commandBuilder.Build(args.ConnectionString, reportParsingResult.Text, reportParsingResult.CommandType, args.Parameters, args.Variables, args.Timeout);

            return(cmd);
        }
コード例 #3
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"));
        }
コード例 #4
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"));
        }
コード例 #5
0
ファイル: FileReportingParserTest.cs プロジェクト: ywscr/NBi
        public void ExtractQuery_NonExistingDataSetOneExisting_CorrectExceptionReturned()
        {
            var request = new ReportDataSetRequest(
                string.Empty
                , ReportFileDirectory
                , "Currency_List"
                , "Non Existing"
                );

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

            Assert.That(ex.Message, Does.Contain("'Currency'"));
        }
コード例 #6
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"));
        }
コード例 #7
0
        public void ExtractQuery_SharedDataSetViaReport_CorrectQuery()
        {
            var request = new ReportDataSetRequest(
                ConnectionStringReader.GetReportServerDatabase()
                , "/AdventureWorks Sample Reports/"
                , "Employee_Sales_Summary"
                , "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));
        }
コード例 #8
0
        public override string GetQuery()
        {
            var factory = new ReportingParserFactory();
            var parser  = factory.Instantiate(Source);

            var request = new ReportDataSetRequest
                          (
                Source ?? Settings.BasePath,
                Path,
                Name,
                Dataset
                          );

            command = parser.ExtractCommand(request);

            return(command.Text);
        }
コード例 #9
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));
        }
コード例 #10
0
ファイル: FileReportingParserTest.cs プロジェクト: ywscr/NBi
        public void ExtractQuery_ExistingReportAndDataSet_CorrectQueryReturned()
        {
            var request = new ReportDataSetRequest(
                string.Empty
                , ReportFileDirectory
                , "Currency_List"
                , "Currency"
                );

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

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