Skip to content

Commit

Permalink
feat: format code with csharpier
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-tihon committed Sep 8, 2024
1 parent e96ccd2 commit 9d31abd
Show file tree
Hide file tree
Showing 116 changed files with 27,818 additions and 14,696 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 2.2.0 - September 8, 2024
## [2.2.0] - September 8, 2024

- DocumentFormat.OpenXml 3.0.2 -> 3.1.0
- DocumentFormat.OpenXml.Framework 3.0.2 -> 3.1.0
Expand Down
173 changes: 65 additions & 108 deletions Clippit.Tests/Common/ChartUpdaterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ namespace Clippit.Tests.Common
{
public class ChartUpdaterTests : TestsBase
{
public ChartUpdaterTests(ITestOutputHelper log) : base(log)
{
}

public ChartUpdaterTests(ITestOutputHelper log)
: base(log) { }

[Theory]
[InlineData("CU001-Chart-Cached-Data-01.docx")]
[InlineData("CU002-Chart-Cached-Data-02.docx")]
Expand All @@ -29,7 +28,6 @@ public ChartUpdaterTests(ITestOutputHelper log) : base(log)
[InlineData("CU006-Chart-Cached-Data-06.docx")]
[InlineData("CU007-Chart-Cached-Data-07.docx")]
[InlineData("CU008-Chart-Cached-Data-08.docx")]

[InlineData("CU009-Chart-Embedded-Xlsx-01.docx")]
[InlineData("CU010-Chart-Embedded-Xlsx-02.docx")]
[InlineData("CU011-Chart-Embedded-Xlsx-03.docx")]
Expand All @@ -39,10 +37,8 @@ public ChartUpdaterTests(ITestOutputHelper log) : base(log)
[InlineData("CU015-Chart-Embedded-Xlsx-07.docx")]
[InlineData("CU016-Chart-Embedded-Xlsx-08.docx")]
[InlineData("CU017-Chart-Embedded-Xlsx-10.docx")]

[InlineData("CU018-Chart-Cached-Data-41.pptx")]
[InlineData("CU019-Chart-Embedded-Xlsx-41.pptx")]

public void CU001(string name)
{
var sourceDir = new DirectoryInfo("../../../../TestFiles/");
Expand All @@ -52,109 +48,64 @@ public void CU001(string name)
{
var wmlTemplate = new WmlDocument(templateFile.FullName);

var afterUpdatingDocx = new FileInfo(Path.Combine(TempDir, templateFile.Name.Replace(".docx", "-processed-by-ChartUpdater.docx")));
var afterUpdatingDocx = new FileInfo(
Path.Combine(
TempDir,
templateFile.Name.Replace(".docx", "-processed-by-ChartUpdater.docx")
)
);
wmlTemplate.SaveAs(afterUpdatingDocx.FullName);

using var wDoc = WordprocessingDocument.Open(afterUpdatingDocx.FullName, true);
var chart1Data = new ChartData
{
SeriesNames = new[] {
"Car",
"Truck",
"Van",
"Bike",
"Boat",
},
SeriesNames = new[] { "Car", "Truck", "Van", "Bike", "Boat" },
CategoryDataType = ChartDataType.String,
CategoryNames = new[] {
"Q1",
"Q2",
"Q3",
"Q4",
},
CategoryNames = new[] { "Q1", "Q2", "Q3", "Q4" },
Values = new[]
{
new double[] {
100, 310, 220, 450,
},
new double[] {
200, 300, 350, 411,
},
new double[] {
80, 120, 140, 600,
},
new double[] {
120, 100, 140, 400,
},
new double[] {
200, 210, 210, 480,
},
new double[] { 100, 310, 220, 450 },
new double[] { 200, 300, 350, 411 },
new double[] { 80, 120, 140, 600 },
new double[] { 120, 100, 140, 400 },
new double[] { 200, 210, 210, 480 },
},
};
ChartUpdater.UpdateChart(wDoc, "Chart1", chart1Data);

var chart2Data = new ChartData
{
SeriesNames = new[] {
"Series"
},
SeriesNames = new[] { "Series" },
CategoryDataType = ChartDataType.String,
CategoryNames = new[] {
"Cars",
"Trucks",
"Vans",
"Boats",
},
Values = new[]
{
new double[] {
320, 112, 64, 80,
},
},
CategoryNames = new[] { "Cars", "Trucks", "Vans", "Boats" },
Values = new[] { new double[] { 320, 112, 64, 80 } },
};
ChartUpdater.UpdateChart(wDoc, "Chart2", chart2Data);

var chart3Data = new ChartData
{
SeriesNames = new[] {
"X1",
"X2",
"X3",
"X4",
"X5",
"X6",
},
SeriesNames = new[] { "X1", "X2", "X3", "X4", "X5", "X6" },
CategoryDataType = ChartDataType.String,
CategoryNames = new[] {
"Y1",
"Y2",
"Y3",
"Y4",
"Y5",
"Y6",
},
CategoryNames = new[] { "Y1", "Y2", "Y3", "Y4", "Y5", "Y6" },
Values = new[]
{
new[] { 3.0, 2.1, .7, .7, 2.1, 3.0, },
new[] { 3.0, 2.1, .8, .8, 2.1, 3.0, },
new[] { 3.0, 2.4, 1.2, 1.2, 2.4, 3.0, },
new[] { 3.0, 2.7, 1.7, 1.7, 2.7, 3.0, },
new[] { 3.0, 2.9, 2.5, 2.5, 2.9, 3.0, },
new[] { 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, },
new[] { 3.0, 2.1, .7, .7, 2.1, 3.0 },
new[] { 3.0, 2.1, .8, .8, 2.1, 3.0 },
new[] { 3.0, 2.4, 1.2, 1.2, 2.4, 3.0 },
new[] { 3.0, 2.7, 1.7, 1.7, 2.7, 3.0 },
new[] { 3.0, 2.9, 2.5, 2.5, 2.9, 3.0 },
new[] { 3.0, 3.0, 3.0, 3.0, 3.0, 3.0 },
},
};
ChartUpdater.UpdateChart(wDoc, "Chart3", chart3Data);

var chart4Data = new ChartData
{
SeriesNames = new[] {
"Car",
"Truck",
"Van",
},
SeriesNames = new[] { "Car", "Truck", "Van" },
CategoryDataType = ChartDataType.DateTime,
CategoryFormatCode = 14,
CategoryNames = new[] {
CategoryNames = new[]
{
ToExcelInteger(new DateTime(2013, 9, 1)),
ToExcelInteger(new DateTime(2013, 9, 2)),
ToExcelInteger(new DateTime(2013, 9, 3)),
Expand All @@ -178,15 +129,31 @@ public void CU001(string name)
},
Values = new[]
{
new double[] {
1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 5, 4, 5, 6, 7, 8, 7, 8, 8, 9,
},
new double[] {
2, 3, 3, 4, 4, 5, 6, 7, 8, 7, 8, 9, 9, 9, 7, 8, 9, 9, 10, 11,
},
new double[] {
2, 3, 3, 3, 3, 2, 2, 2, 3, 2, 3, 3, 4, 4, 4, 3, 4, 5, 5, 4,
new double[] { 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 5, 4, 5, 6, 7, 8, 7, 8, 8, 9 },
new double[]
{
2,
3,
3,
4,
4,
5,
6,
7,
8,
7,
8,
9,
9,
9,
7,
8,
9,
9,
10,
11,
},
new double[] { 2, 3, 3, 3, 3, 2, 2, 2, 3, 2, 3, 3, 4, 4, 4, 3, 4, 5, 5, 4 },
},
};
ChartUpdater.UpdateChart(wDoc, "Chart4", chart4Data);
Expand All @@ -195,35 +162,25 @@ public void CU001(string name)
{
var pmlTemplate = new PmlDocument(templateFile.FullName);

var afterUpdatingPptx = new FileInfo(Path.Combine(TempDir, templateFile.Name.Replace(".pptx", "-processed-by-ChartUpdater.pptx")));
var afterUpdatingPptx = new FileInfo(
Path.Combine(
TempDir,
templateFile.Name.Replace(".pptx", "-processed-by-ChartUpdater.pptx")
)
);
pmlTemplate.SaveAs(afterUpdatingPptx.FullName);

using var pDoc = PresentationDocument.Open(afterUpdatingPptx.FullName, true);
var chart1Data = new ChartData
{
SeriesNames = new[] {
"Car",
"Truck",
"Van",
},
SeriesNames = new[] { "Car", "Truck", "Van" },
CategoryDataType = ChartDataType.String,
CategoryNames = new[] {
"Q1",
"Q2",
"Q3",
"Q4",
},
CategoryNames = new[] { "Q1", "Q2", "Q3", "Q4" },
Values = new[]
{
new double[] {
320, 310, 320, 330,
},
new double[] {
201, 224, 230, 221,
},
new double[] {
180, 200, 220, 230,
},
new double[] { 320, 310, 320, 330 },
new double[] { 201, 224, 230, 221 },
new double[] { 180, 200, 220, 230 },
},
};
ChartUpdater.UpdateChart(pDoc, 1, chart1Data);
Expand Down
8 changes: 3 additions & 5 deletions Clippit.Tests/Common/MetricsGetterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ namespace Clippit.Tests.Common
{
public class MetricsGetterTests : TestsBase
{
public MetricsGetterTests(ITestOutputHelper log) : base(log)
{
}

public MetricsGetterTests(ITestOutputHelper log)
: base(log) { }

[Theory]
[InlineData("Presentation.pptx")]
[InlineData("Spreadsheet.xlsx")]
Expand Down Expand Up @@ -61,7 +60,6 @@ public void MG001(string name)

Assert.NotNull(metrics);
}

}
}

Expand Down
Loading

0 comments on commit 9d31abd

Please sign in to comment.