public void TestMethod1() { var dataSource = new Dictionary <string, long?>(); dataSource.Add("事业1部", 1); dataSource.Add("事业2部", 2); dataSource.Add("事业3部", null); var excelList = Sample05.Run(dataSource); var resultList = excelList.GetEmpty().ToList(); resultList.Add(new Sample05.ExcelModel { 序号 = 1, 部门 = new KV <string, long?>("事业1部", 1), 部门2 = new KV <string, long?>("事业1部", 1) }); resultList.Add(new Sample05.ExcelModel { 序号 = 2, 部门 = new KV <string, long?>("事业2部", 2), 部门2 = new KV <string, long?>("111") }); resultList.Add(new Sample05.ExcelModel { 序号 = 3, 部门 = new KV <string, long?>("事业3部", null), 部门2 = new KV <string, long?>("222") }); var index = 2; var a = excelList[index]; var b = resultList[index]; CollectionAssert.AreEqual(excelList, resultList); }
static void Main(string[] args) { string demo = "Sample11"; switch (demo) { case "Sample1": Sample01.Demo(); break; case "Sample2": Sample02.Demo(); break; case "Sample3": Sample03.Demo(); break; case "Sample4": Sample04.Demo(); break; case "Sample5": Sample05.Demo(); break; case "Sample6": Sample06.Demo(); break; case "Sample7": Sample07.Demo(); break; case "Sample8": Sample08.Demo(); break; case "Sample9": Sample09.Demo(); break; case "Sample10": Sample10.Demo(); break; case "Sample11": Sample11.Demo(); break; default: break; } }
public void 数据源缺少事业2部_会异常() { var dataSource = new Dictionary <string, long?>(); dataSource.Add("事业1部", 1); //dataSource.Add("事业2部", 2); dataSource.Add("事业3部", null); Assert.ThrowsException <ArgumentException>(() => Sample05.Run(dataSource)); try { Sample05.Run(dataSource); } catch (Exception ex) { Assert.AreEqual(ex.Message, $@"'事业2部'在数据库中未找到 参数名: 部门"); } }
private void CreateGUI() { var root = rootVisualElement; root.styleSheets.Add(styleSheet); visualTree.CloneTree(root); root.Bind(new SerializedObject(this)); root.Q <Button>("sample01").clicked += async() => { var ret = await Sample01.OnClick(out code); result = $"{ret}"; }; root.Q <Button>("sample02").clicked += async() => { var ret = await Sample02.OnClick(out code); result = $"{ret}"; }; root.Q <Button>("sample03").clicked += async() => { var ret = await Sample03.OnClick(out var c, out var globals); code = $"{c}, {globals}"; result = $"{ret}"; }; root.Q <Button>("sample04").clicked += () => { result = Sample04.OnClick(out code); }; root.Q <Button>("sample05").clicked += () => { var ret = Sample05.OnClick(out code); result = string.Join("\n", ret.Select(e => e.Name)); }; }
static void Main(string[] args) { Console.Title = Constants.AppName; ILogger logger = new Logger(Constants.AppName, new ILog[] { new FileLog(), new ColoredConsoleLog() }) { Deep = LogDeep.OnlyApplicationCalls, Status = LogStatus.Running }; logger.Debug(">Start Logging<"); // 01. Generate sample 01 logger.Info(""); logger.Info("> Shows the use of how creates a report"); Sample01.Generate(logger); // 02. Generate sample 02 logger.Info(""); logger.Info("> Shows the use of how creates a report with minicharts"); Sample02.Generate(logger); // 03. Generate sample 03 logger.Info(""); logger.Info("> Shows the use of how creates a report with minicharts and conditional inserts"); Sample03.Generate(logger); // 04. Generate sample 04 logger.Info(""); logger.Info("> Shows the use of how serialize and deserialize global settings, styles, pictures, shapes and mini-charts"); Sample04.Generate(logger); // 05. Generate sample 05 logger.Info(""); logger.Info("> Shows the use of how insert an autofilter"); Sample05.Generate(logger); // 06. Generate sample 06 logger.Info(""); logger.Info("> Shows how to use insert datatable and generic collections"); Sample06.Generate(logger); // 07. Generate sample 07 logger.Info(""); logger.Info("> Shows how to insert a pictures"); Sample07.Generate(logger); // 08. Generate sample 08 logger.Info(""); logger.Info("> Shows how to insert a shapes with shape effects"); Sample08.Generate(logger); // 09. Generate sample 09 logger.Info(""); logger.Info("> Shows how to insert an image from uri (stream)"); Sample09.Generate(logger); // 10. Generate sample 10 logger.Info(""); logger.Info("> Shows how to insert a pictures with shape effects"); Sample10.Generate(logger); // 11. Generate sample 11 logger.Info(""); logger.Info("> Shows how to copy ranges"); Sample11.Generate(logger); // 12. Generate sample 12 logger.Info(""); logger.Info("> Shows how to transpose a range of data"); Sample12.Generate(logger); // 13.Generate sample 13 logger.Info(""); logger.Info("> Shows how to use aggregate functions with a data range"); Sample13.Generate(logger); // 14.Generate sample 14 logger.Info(""); logger.Info("> Shows the use stacked charts"); Sample14.Generate(logger); // 15.Generate sample 15 logger.Info(""); logger.Info("> Shows the use charts with more than one chart type and secondary axis"); Sample15.Generate(logger); logger.Info(""); logger.Debug(">End Logging<"); Console.ReadKey(); }
static void Main(string[] args) { Console.Title = Constants.AppName; ILogger logger = new Logger(Constants.AppName, new ILog[] { new FileLog(), new ColoredConsoleLog() }) { Deep = LogDeep.OnlyApplicationCalls, Status = LogStatus.Running }; logger.Debug(">Start Logging<"); // 01. Generate sample 01 report logger.Info(""); logger.Info("> Start Pdf Sample 01"); logger.Info(" > Shows the use of text and image replacement"); Sample01.Generate(logger); // 02. Generate sample 02 report logger.Info(""); logger.Info("> Start Pdf Sample 02"); logger.Info(" > Shows the use of html table replacement in a pdf document"); Sample02.Generate(logger); // 03. Generate sample 03 report logger.Info(""); logger.Info("> Start Pdf Sample 03"); logger.Info(" > Shows the use of merge action"); Sample03.Generate(logger); // 04. Generate sample 04 report logger.Info(""); logger.Info("> Start Pdf Sample 04"); logger.Info(" > Shows the header replacement after merge action"); Sample04.Generate(logger); // 05. Generate sample 05 report logger.Info(""); logger.Info("> Start Pdf Sample 05"); logger.Info(" > Shows the use of System Tags such as page number"); Sample05.Generate(logger); // 06. Generate sample 06 report logger.Info(""); logger.Info("> Start Pdf Sample 06"); logger.Info(" > Shows the use of test mode"); Sample06.Generate(logger, useTestMode: YesNo.Yes); // 07.Generate sample 07 report logger.Info(""); logger.Info("> Start Pdf Sample 07"); logger.Info(" > Shows the use of save as zip a input with user-defined filename"); Sample07.Generate(logger); // 08. Generate sample 08 report logger.Info(""); logger.Info("> Start Pdf Sample 08"); logger.Info(" > Shows the use of save as zip merged output"); Sample08.Generate(logger); // 09. Generate sample 09 report logger.Info(""); logger.Info("> Start Pdf Sample 09"); logger.Info(" > Shows the use of compression threshold (>2MB) when merge and zip files (NO zipped)"); Sample09.Generate(logger); // 10.Generate sample 10 report logger.Info(""); logger.Info("> Start Pdf Sample 10"); logger.Info(" > Shows the use of save as zip a input with random name"); Sample10.Generate(logger); // 12. Generate sample 12 report logger.Info(""); logger.Info("> Start Pdf Sample 12"); logger.Info(" > Shows the use of how serialize and deserialize text, image and table styles"); Sample12.Generate(logger); logger.Info(""); logger.Debug(">End Logging<"); Console.ReadKey(); }