Fix CI error CS0122: 'DateTimeHelper' is inaccessible due to its protection level

This commit is contained in:
WeiHanLin 2021-06-30 23:19:57 +08:00
parent 0904a80d10
commit 09efad8aa1
3 changed files with 5 additions and 18 deletions

View File

@ -1,7 +1,7 @@
version: build-{build} version: build-{build}
skip_tags: true skip_tags: true
image: Visual Studio 2019 image: Visual Studio 2019
configuration: Release configuration: Debug
build_script: build_script:
- ps: |- - ps: |-
#cd src #cd src

View File

@ -6,8 +6,6 @@
internal static partial class DateTimeHelper internal static partial class DateTimeHelper
{ {
private static DateTime basicDate = new DateTime(2021, 01, 01);
/// <summary> /// <summary>
/// NumberFormat from NuGet ExcelNumberFormat MIT@License /// NumberFormat from NuGet ExcelNumberFormat MIT@License
/// </summary> /// </summary>
@ -15,17 +13,6 @@
{ {
return new NumberFormat(formatCode).IsDateTimeFormat; 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 internal static partial class DateTimeHelper

View File

@ -15,7 +15,7 @@ namespace MiniExcelLibs.Tests
public class MiniExcelCsvAsycTests public class MiniExcelCsvAsycTests
{ {
[Fact] [Fact]
public async Task gb2312_Encoding_Read_Test() public async Task Gb2312_Encoding_Read_Test()
{ {
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
var path = PathHelper.GetSamplePath("csv/gb2312_Encoding_Read_Test.csv"); var path = PathHelper.GetSamplePath("csv/gb2312_Encoding_Read_Test.csv");
@ -183,7 +183,7 @@ namespace MiniExcelLibs.Tests
public async Task CsvExcelTypeTest() 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" } }; var input = new[] { new { A = "Test1", B = "Test2" } };
await MiniExcel.SaveAsAsync(path, input); await MiniExcel.SaveAsAsync(path, input);
@ -215,7 +215,7 @@ namespace MiniExcelLibs.Tests
[Fact()] [Fact()]
public async Task Create2x2_Test() 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[] { await MiniExcel.SaveAsAsync(path, new[] {
new { c1 = "A1" ,c2 = "B1"}, new { c1 = "A1" ,c2 = "B1"},
new { c1 = "A2" ,c2 = "B2"}, new { c1 = "A2" ,c2 = "B2"},
@ -244,7 +244,7 @@ namespace MiniExcelLibs.Tests
[Fact()] [Fact()]
public async Task CsvTypeMappingTest() 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[] { await MiniExcel.SaveAsAsync(path, new[] {
new { c1 = "A1" ,c2 = "B1"}, new { c1 = "A1" ,c2 = "B1"},
new { c1 = "A2" ,c2 = "B2"}, new { c1 = "A2" ,c2 = "B2"},