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); }
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); }
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")); }
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")); }
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'")); }
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")); }
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)); }
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); }
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)); }
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)); }