using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.Scraper;
using skyscraper5.Skyscraper.Scraper.Storage.InMemory;
using skyscraper8.Skyscraper.Scraper.Storage;

namespace skyscraper8.Tests.ResourceTests
{
	[TestClass]
	public class SkyscraperTests : Feyllure
	{
		[TestMethod]
		public void RunTestPatterns()
		{
			byte[][] buffers = new byte[][]
			{
				Resources1.test_1packet_01, 
				Resources1.test_2packets_02_03, 
				Resources1.test_3packets_04_05_06
			};

			InMemoryScraperStorageFactory imssf = new InMemoryScraperStorageFactory();

			foreach (byte[] buffer in buffers)
			{
				TsContext mpeg2 = new TsContext();
				DataStorage ds = new InMemoryScraperStorageFactory().CreateDataStorage();
				ObjectStorage os = new NullObjectStorage();
				
				SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, ds, os);
				MemoryStream ms = new MemoryStream(buffer, false);
				
				skyscraper.InitalizeFilterChain();
				skyscraper.IngestFromStream(ms);
				
				ms.Close();
				ms.Dispose();
			}
		}
	}
}
