public void TestParseDRZipGroup1() { var filename = "./Resources/Zip1.zip"; using (var zipFile = ZipFile.OpenRead(filename)) { var zipEntries = zipFile.Entries; var drFiles = ComtradeHelper.ParseDRZipGroup(zipEntries); Assert.NotEmpty(drFiles); Assert.Equal(2, drFiles.Count()); foreach (var item in drFiles) { Assert.True(item.FileSize > 1); Assert.NotEmpty(item.FileName); Assert.Contains("010A0005", item.FileName); Assert.True(item.FileName.Length > 4); Assert.NotEmpty(item.FileData); Assert.True(item.FileData.Length > 1); Assert.Equal(ComtradeHelper.TryParseDRDate("04/04/2018,13:45:38.404284").DateTime, item.CreationTime); } } }
public void TestParseFilesGroup() { var filenames = new List <FileInfo>() { new FileInfo("./Resources/Single1.CFG"), new FileInfo("./Resources/Single1.DAT") }; var drFiles = ComtradeHelper.ParseDRFilesGroup(filenames); Assert.NotEmpty(drFiles); Assert.Equal(2, drFiles.Count()); foreach (var item in drFiles) { Assert.True(item.FileSize > 1); Assert.NotEmpty(item.FileName); Assert.Contains("Single1", item.FileName); Assert.True(item.FileName.Length > 4); Assert.NotEmpty(item.FileData); Assert.True(item.FileData.Length > 1); Assert.Equal(ComtradeHelper.TryParseDRDate("05/04/2018,13:45:38.404284").DateTime, item.CreationTime); } }
public void TestParseDRZipGroup2() { var filename = "./Resources/Zip2.zip"; using (var zipFile = ZipFile.OpenRead(filename)) { var zipEntries = zipFile.Entries; var drFiles = ComtradeHelper.ParseDRZipGroup(zipEntries); Assert.NotEmpty(drFiles); Assert.Equal(3, drFiles.Count()); foreach (var item in drFiles) { Assert.True(item.FileSize > 1); Assert.NotEmpty(item.FileName); Assert.Contains("Dist", item.FileName); Assert.True(item.FileName.Length > 4); Assert.NotEmpty(item.FileData); Assert.True(item.FileData.Length > 1); Assert.Equal(ComtradeHelper.TryParseDRDate("20/07/2016,10:09:14.760712").DateTime, item.CreationTime); } } }
public void TestGetTriggerDateTime() { var filename = "./Resources/Single1.CFG"; Assert.Equal(ComtradeHelper.TryParseDRDate("05/04/2018,13:45:38.404284").DateTime, ComtradeHelper.GetTriggerDateTime(filename)); Assert.Equal(5, ComtradeHelper.GetTriggerDateTime(filename).Day); Assert.Equal(4, ComtradeHelper.GetTriggerDateTime(filename).Month); }