From 09efad8aa1c3f8d01639387966ff6a1f8814fe16 Mon Sep 17 00:00:00 2001 From: WeiHanLin Date: Wed, 30 Jun 2021 23:19:57 +0800 Subject: [PATCH] Fix CI error CS0122: 'DateTimeHelper' is inaccessible due to its protection level --- appveyor.yml | 2 +- src/MiniExcel/Utils/DateTimeHelper.cs | 13 ------------- tests/MiniExcelTests/MiniExcelCsvAsycTests.cs | 8 ++++---- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7ac8c6b..b65ae52 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ version: build-{build} skip_tags: true image: Visual Studio 2019 -configuration: Release +configuration: Debug build_script: - ps: |- #cd src diff --git a/src/MiniExcel/Utils/DateTimeHelper.cs b/src/MiniExcel/Utils/DateTimeHelper.cs index 05a701e..276ee22 100644 --- a/src/MiniExcel/Utils/DateTimeHelper.cs +++ b/src/MiniExcel/Utils/DateTimeHelper.cs @@ -6,8 +6,6 @@ internal static partial class DateTimeHelper { - private static DateTime basicDate = new DateTime(2021, 01, 01); - /// /// NumberFormat from NuGet ExcelNumberFormat MIT@License /// @@ -15,17 +13,6 @@ { return new NumberFormat(formatCode).IsDateTimeFormat; } - - public static bool IsSingleDatetimeFormat(string formatCode) - { - var isDatetimeFormat = DateTime.TryParseExact(basicDate.ToString(formatCode), formatCode, CultureInfo.InvariantCulture, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite, out var date); - if (basicDate != date) - isDatetimeFormat = false; - - // TODO: double check - // TODO: datetime format like yyyy need to convert to string not datetime - return isDatetimeFormat; - } } internal static partial class DateTimeHelper diff --git a/tests/MiniExcelTests/MiniExcelCsvAsycTests.cs b/tests/MiniExcelTests/MiniExcelCsvAsycTests.cs index a88cd17..65bea79 100644 --- a/tests/MiniExcelTests/MiniExcelCsvAsycTests.cs +++ b/tests/MiniExcelTests/MiniExcelCsvAsycTests.cs @@ -15,7 +15,7 @@ namespace MiniExcelLibs.Tests public class MiniExcelCsvAsycTests { [Fact] - public async Task gb2312_Encoding_Read_Test() + public async Task Gb2312_Encoding_Read_Test() { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); var path = PathHelper.GetSamplePath("csv/gb2312_Encoding_Read_Test.csv"); @@ -183,7 +183,7 @@ namespace MiniExcelLibs.Tests public async Task CsvExcelTypeTest() { { - var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid().ToString()}.csv"); + var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.csv"); var input = new[] { new { A = "Test1", B = "Test2" } }; await MiniExcel.SaveAsAsync(path, input); @@ -215,7 +215,7 @@ namespace MiniExcelLibs.Tests [Fact()] public async Task Create2x2_Test() { - var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid().ToString()}.csv"); + var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.csv"); await MiniExcel.SaveAsAsync(path, new[] { new { c1 = "A1" ,c2 = "B1"}, new { c1 = "A2" ,c2 = "B2"}, @@ -244,7 +244,7 @@ namespace MiniExcelLibs.Tests [Fact()] public async Task CsvTypeMappingTest() { - var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid().ToString()}.csv"); + var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.csv"); await MiniExcel.SaveAsAsync(path, new[] { new { c1 = "A1" ,c2 = "B1"}, new { c1 = "A2" ,c2 = "B2"},