skyscraper8/skyscraper8.Tests/IntegrationTests.cs
feyris-tan c999a9de4d
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 1m33s
Almost solved the SES-12 puzzle.
2026-01-06 21:21:33 +01:00

35 lines
991 B
C#

using System;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using skyscraper5.Skyscraper;
using skyscraper8.Skyscraper.Scraper.Storage.Tar;
namespace skyscraper8.Tests;
[TestClass]
public class IntegrationTests
{
[TestMethod]
public void CreateTarArchive()
{
string filename = String.Format("{0}.tar", DateTime.Now.ToUnixTime());
FileInfo fi = new FileInfo(filename);
FileStream fileStream = fi.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
fi.Refresh();
Assert.IsTrue(fi.Exists);
Random rng = new Random();
TarArchive tar = new TarArchive(fileStream);
for (int i = 0; i < 42; i++)
{
filename = String.Format("{0}.bin", i);
int randomSize = rng.Next(4096);
byte[] buffer = new byte[randomSize];
rng.NextBytes(buffer);
tar.WriteEntry(filename, buffer);
}
}
}