private ReportModel CreateModel() { ReportModel m = ReportModel.Create(); Properties customizer = new Properties(); customizer.Set("ReportLayout", GlobalEnums.ReportLayout.ListLayout); IReportGenerator generator = new GeneratePlainReport(m, customizer); generator.GenerateReport(); ReportLoader rl = new ReportLoader(); // Console.WriteLine (generator.XmlReport.DocumentElement); object root = rl.Load(generator.XmlReport.DocumentElement); ReportModel model = root as ReportModel; if (model != null) { model.ReportSettings.FileName = GlobalValues.PlainFileName; FilePathConverter.AdjustReportName(model); } else { throw new InvalidReportModelException(); } return(model); }
public void Should_Return_False_When_Source_Type_Is_Not_FilePath() { var converter = new FilePathConverter(); var result = converter.CanConvertTo(typeof(DateTime)); Assert.False(result); }
public void Should_Return_True_When_Destination_Type_Is_FilePath() { var converter = new FilePathConverter(); var result = converter.CanConvertTo(typeof(FilePath)); Assert.True(result); }
public void Should_Throw_NotSupportedException_When_Value_Is_Not_A_Valid_File_Path() { var converter = new FilePathConverter(); var result = Record.Exception(() => converter.ConvertFrom(DateTime.Now)); Assert.IsType <NotSupportedException>(result); }
public void Should_Return_True_When_Source_Type_Is_String() { var converter = new FilePathConverter(); var result = converter.CanConvertFrom(typeof(string)); Assert.True(result); }
public void Should_Convert_File_Path_To_String_Value_Using_FullPath() { var converter = new FilePathConverter(); var result = converter.ConvertTo(FilePath.FromString("c:/data/work/file.txt"), typeof(string)); Assert.IsType <string>(result); Assert.Equal("c:/data/work/file.txt", result); }
public void Should_Convert_String_Value_To_File_Path() { var converter = new FilePathConverter(); var result = converter.ConvertFrom("c:/data/work/file.txt"); Assert.IsType <FilePath>(result); Assert.Equal("c:/data/work/file.txt", ((FilePath)result).FullPath); }
public void Should_Throw_NotSupportedException_When_Destination_Type_Is_Not_String() { var converter = new FilePathConverter(); var result = Record.Exception(() => converter.ConvertTo(FilePath.FromString("c:/data/work/file.txt"), typeof(DateTime))); Assert.IsType <NotSupportedException>(result); }
public ReportModel CreateRenderableModel() { ReportModel m = new ReportModel(); generator.MergeFormChanges((System.CodeDom.CodeCompileUnit)null); XmlDocument doc = new XmlDocument(); doc.LoadXml(generator.ViewContent.ReportFileContent); ReportLoader rl = new ReportLoader(); object root = rl.Load(doc.DocumentElement); m = root as ReportModel; m.ReportSettings.FileName = generator.ViewContent.PrimaryFileName; FilePathConverter.AdjustReportName(m); return(m); }
public static ReportModel CreateModel(string reportName, bool createGrouping) { ReportStructure structure = CreateReportStructure(reportName); AvailableFieldsCollection abstractColumns = new AvailableFieldsCollection(); AbstractColumn a1 = new AbstractColumn("Field1", typeof(System.String)); structure.AvailableFieldsCollection.Add(a1); ICSharpCode.Reports.Core.BaseDataItem bri = new ICSharpCode.Reports.Core.BaseDataItem(); bri.Name = "Field1"; structure.ReportItemCollection.Add(bri); if (createGrouping) { structure.Grouping = "group"; } ReportModel m = structure.CreateAndFillReportModel(); ICSharpCode.Core.Properties customizer = new ICSharpCode.Core.Properties(); customizer.Set("Generator", structure); customizer.Set("ReportLayout", GlobalEnums.ReportLayout.ListLayout); IReportGenerator generator = new GeneratePushDataReport(m, customizer); generator.GenerateReport(); ReportLoader rl = new ReportLoader(); object root = rl.Load(generator.XmlReport.DocumentElement); ReportModel model = root as ReportModel; if (model != null) { model.ReportSettings.FileName = GlobalValues.PlainFileName; FilePathConverter.AdjustReportName(model); } else { throw new InvalidReportModelException(); } return(model); }
private ReportModel CreateModel() { ReportModel m = ReportModel.Create(); ReportStructure reportStructure = new ReportStructure() { ReportLayout = GlobalEnums.ReportLayout.ListLayout }; IReportGenerator generator = new GenerateFormSheetReport(m, reportStructure); generator.GenerateReport(); ReportLoader loader = new ReportLoader(); object root = loader.Load(generator.XmlReport.DocumentElement); ReportModel model = root as ReportModel; model.ReportSettings.FileName = GlobalValues.PlainFileName; FilePathConverter.AdjustReportName(model); return(model); }