예제 #1
0
        public async Task CurrentListing()
        {
            var listings = await SettlementReader.CurrentAvailableAsync();

            Assert.NotNull(listings);
            foreach (var listing in listings)
            {
                Assert.NotNull(listing);
            }
        }
예제 #2
0
        public async Task DownloadFile()
        {
            var latestListing = (await SettlementReader.CurrentAvailableAsync()).First();

            Assert.NotNull(latestListing);
            var savedFile = await latestListing.SaveReportAsync("abc");

            Assert.NotNull(savedFile);
            Assert.True(savedFile.Exists);
        }
예제 #3
0
        public async Task DownloadAllCurrent()
        {
            var reportFiles = await SettlementReader.DownloadAllAsync();

            Assert.NotNull(reportFiles);
            foreach (var reportFile in reportFiles)
            {
                Assert.NotNull(reportFile);
                Assert.True(reportFile.Exists);
            }
        }
예제 #4
0
        public async Task GetFileData()
        {
            var latestListing = (await SettlementReader.CurrentAvailableAsync()).First();

            Assert.NotNull(latestListing);
            var data = await latestListing.GetDataAsync();

            Assert.NotEmpty(data);
            var tempPath = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid().ToString()}.zip");

            File.WriteAllBytes(tempPath, data);
            var info = new FileInfo(tempPath);

            Assert.True(info.Exists);
        }
예제 #5
0
        public async Task ReadSettlementData()
        {
            var latestListing = (await SettlementReader.CurrentAvailableAsync()).First();

            Assert.NotNull(latestListing);
            var data = await latestListing.GetDataAsync();

            Assert.NotEmpty(data);
            var settlements = await data.ReadSettlements();

            Assert.All(settlements, Assert.NotNull);
            var nuclearPowerRecords = settlements.WhereP(z => z.EnergySource.Equals("NUC", StringComparison.OrdinalIgnoreCase));

            Assert.NotEmpty(nuclearPowerRecords);
        }
예제 #6
0
        public async Task Unzip()
        {
            var latestListing = (await SettlementReader.CurrentAvailableAsync()).First();

            Assert.NotNull(latestListing);
            var savedFile = await latestListing.SaveReportAsync(SettlementReader.ExtractIdFn(latestListing));

            Assert.NotNull(savedFile);
            Assert.True(savedFile.Exists);
            var files = savedFile.UnZip();

            foreach (var extracted in files)
            {
                Assert.NotNull(extracted);
                Assert.True(extracted.Exists);
            }
        }