mirror of
https://gitee.com/dotnetchina/MiniExcel.git
synced 2024-11-30 02:47:39 +08:00
tests SaveAs enum mapping
This commit is contained in:
parent
3469d7f5b8
commit
d31308f1d6
Binary file not shown.
@ -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<Issue89VO>(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<Issue89VO>(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
|
||||
|
@ -100,6 +100,8 @@ namespace MiniExcelLibs.Tests.Utils
|
||||
|
||||
return refV;
|
||||
}
|
||||
|
||||
public static string GetTempXlsxPath() => Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.xlsx");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user