public void TestParseFilesGroupFolder()
        {
            var dir = @"C:\Users\admin\Desktop\Ordos DRs\Ordos\GIS 23KV\1\";

            if (!Directory.Exists(dir))
            {
                return;
            }

            var drFileList = new DirectoryInfo(dir)
                             .EnumerateFiles("*.*", SearchOption.AllDirectories)
                             .Where(x => x.Name.IsPartOfDisturbanceRecording());

            var disturbanceRecordings = ComtradeHelper.ParseSingleFilesCollection(drFileList, 1);

            Assert.NotEmpty(disturbanceRecordings);

            foreach (var dr in disturbanceRecordings)
            {
                Assert.NotEmpty(dr.Name);

                var drFiles = dr.DRFiles;

                Assert.NotEmpty(drFiles);
                Assert.True(drFiles.Count() > 1);

                foreach (var item in drFiles)
                {
                    Assert.True(item.FileSize > 1);

                    Assert.NotEmpty(item.FileName);
                    Assert.True(item.FileName.Length > 4);

                    Assert.NotEmpty(item.FileData);
                    Assert.True(item.FileData.Length > 1);

                    Assert.Contains(dr.Name, item.FileName);
                    Assert.Equal(dr.TriggerTime, item.CreationTime);
                }
            }
        }
Beispiel #2
0
        public void TestParseFilesGroupFolder()
        {
            var drFileList = new DirectoryInfo("./Resources/")
                             .EnumerateFiles("*.*", SearchOption.AllDirectories)
                             .Where(x => !x.Name.Contains("Empty"))
                             .Where(x => x.Name.IsPartOfDisturbanceRecording());

            var disturbanceRecordings = ComtradeHelper.ParseSingleFilesCollection(drFileList, 1);

            Assert.NotEmpty(disturbanceRecordings);
            Assert.Equal(2, disturbanceRecordings.Count());

            foreach (var dr in disturbanceRecordings)
            {
                Assert.NotEmpty(dr.Name);

                var drFiles = dr.DRFiles;

                Assert.NotEmpty(drFiles);
                Assert.True(drFiles.Count() > 1);

                foreach (var item in drFiles)
                {
                    Assert.True(item.FileSize > 1);

                    Assert.NotEmpty(item.FileName);
                    Assert.True(item.FileName.Length > 4);

                    Assert.NotEmpty(item.FileData);
                    Assert.True(item.FileData.Length > 1);

                    Assert.Contains(dr.Name, item.FileName);
                    Assert.Equal(dr.TriggerTime, item.CreationTime);
                }
            }
        }