33 lines
876 B
C#
33 lines
876 B
C#
using System;
|
|
using System.IO;
|
|
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);
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|