From d31308f1d66f530b99af90bb0d5a739146d30b59 Mon Sep 17 00:00:00 2001 From: wei Date: Mon, 26 Apr 2021 12:00:41 +0800 Subject: [PATCH] tests SaveAs enum mapping --- samples/xlsx/TestIssue208.xlsx | Bin 8650 -> 0 bytes tests/MiniExcelTests/MiniExcelIssueTests.cs | 19 ++++++++++++++++--- tests/MiniExcelTests/Utils/Helpers.cs | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-) delete mode 100644 samples/xlsx/TestIssue208.xlsx diff --git a/samples/xlsx/TestIssue208.xlsx b/samples/xlsx/TestIssue208.xlsx deleted file mode 100644 index 43c13e501812d844866d89db734984acbf08fa90..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8650 zcmeHs1y>yD)^+3V8YDn)cXzko?(R+#JZNwY?t$PMAh^4`1a}DT4gubtxijC)Wb*xj zd#hI0vwC&yv#RSk`|Kl%vJjA%0B8U#001BX7@uTX>Vp9Qv5)`&1^^aZN7TXI#mwHt zK-I(145-K8Zf8sU84{c-8vqWv|9{7S@f#>h7?$s5LKVN2`XRbaFSA@N1j~LL(2q`| zB+$_l-&bOylVxS~k`?xdDw2a`%~^#$zU;+vK5AKQZ&w!(+Sja%7~wzAp{9?|$=KU} zMBa|`D$ZG3>ogk^Ux@jYfkBjcIv~ZVzFV11Y(rS449^k^TflECbFp6?ZLO~nu|&Iw zdtj+^U0!_^jccfQ8g*+DW5(Kw+Drd(i(VQs;*HlbwyS==B8jF7wXt%e^Fy+18<47j zb=J@Xe3dCUwiS70Yz?}(jq|k}8(wvB_*IE^U#tynySJ{lXFFAN#FgSh69<;10liL^ zkUvSl)I31ZCZYzroW*|peUBhk?%UzBF5;C(@(m1vo;7^armUD)Q+eDsc696c{aIoP z+?+H4K7|8=4O|@x$0h{c_63tL+mPaSFPJxI`%RY}BB+BMBxLVHj@JkFdA*J%c60(y z&Xe|iS)QQ*fR`5tfZ{)BS*ylGdIj>ew;UY_*Cjg$iVIFN-U~~tedb@Gl{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vVTDV0Co7^!T+Bo?ay|8?$!Ne zDGc%dJ;c8{cRySCxi#~bm38D_Hfnx0@N;tcmjMIp-wphgYW@uUS;+r_GQ9c^^k-TB z*}^|{^DjIA0EPzu{7XfDhW|4J{vG~~;BW9h0-~ZU6liw=0C>>p2NG&FqTjy#AM|ef A761SM diff --git a/tests/MiniExcelTests/MiniExcelIssueTests.cs b/tests/MiniExcelTests/MiniExcelIssueTests.cs index 64abea7..7ec295e 100644 --- a/tests/MiniExcelTests/MiniExcelIssueTests.cs +++ b/tests/MiniExcelTests/MiniExcelIssueTests.cs @@ -38,8 +38,6 @@ namespace MiniExcelLibs.Tests Assert.Equal("test1", rows[0].V); Assert.Equal("test2", rows[1].V); - - Console.WriteLine(rows); } } @@ -65,6 +63,14 @@ Leave"; Assert.Equal(Issue89VO.WorkState.OnDuty, rows[0].State); Assert.Equal(Issue89VO.WorkState.Fired, rows[1].State); Assert.Equal(Issue89VO.WorkState.Leave, rows[2].State); + + var outputPath = Helpers.GetTempXlsxPath(); + MiniExcel.SaveAs(outputPath, rows); + var rows2 = MiniExcel.Query(outputPath).ToList(); + + Assert.Equal(Issue89VO.WorkState.OnDuty, rows2[0].State); + Assert.Equal(Issue89VO.WorkState.Fired, rows2[1].State); + Assert.Equal(Issue89VO.WorkState.Leave, rows2[2].State); } //xlsx @@ -75,8 +81,15 @@ Leave"; Assert.Equal(Issue89VO.WorkState.OnDuty, rows[0].State); Assert.Equal(Issue89VO.WorkState.Fired, rows[1].State); Assert.Equal(Issue89VO.WorkState.Leave, rows[2].State); - } + var outputPath = Helpers.GetTempXlsxPath(); + MiniExcel.SaveAs(outputPath, rows); + var rows2 = MiniExcel.Query(outputPath).ToList(); + + Assert.Equal(Issue89VO.WorkState.OnDuty, rows2[0].State); + Assert.Equal(Issue89VO.WorkState.Fired, rows2[1].State); + Assert.Equal(Issue89VO.WorkState.Leave, rows2[2].State); + } } public class Issue89VO diff --git a/tests/MiniExcelTests/Utils/Helpers.cs b/tests/MiniExcelTests/Utils/Helpers.cs index 8a8cd5e..de41375 100644 --- a/tests/MiniExcelTests/Utils/Helpers.cs +++ b/tests/MiniExcelTests/Utils/Helpers.cs @@ -100,6 +100,8 @@ namespace MiniExcelLibs.Tests.Utils return refV; } + + public static string GetTempXlsxPath() => Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.xlsx"); } }