using System;
using System.IO;
using InventoryTraker.Web.Utilities;
using NUnit.Framework;

namespace InventoryTraker.Web.Tests.Utilities
{
	[TestFixture]
	public class InventoryParserTests
	{
		private readonly string _documentFolder =
			AppDomain.CurrentDomain.BaseDirectory + @"\Utilities\Documents\";

		[Test]
		public void Parse()
		{
			var fileInfo = new FileInfo(Path.Combine(_documentFolder, "InventoryData.xlsx"));

			var parser = new InventoryParser(fileInfo);

			var forms = parser.Parse();

			foreach (var form in forms)
			{
				Console.WriteLine($"{form.Id} {form.ProgramName} {form.ShredReadyDate}");
			}
		}

		[Test]
		public void Parse_NoExtension()
		{
			var fileInfo = new FileInfo(Path.Combine(_documentFolder, "InventoryData-NoExtension"));

			var parser = new InventoryParser(fileInfo);

			var forms = parser.Parse();

			foreach (var form in forms)
			{
				Console.WriteLine($"{form.Id} {form.ProgramName} {form.ShredReadyDate}");
			}
		}
	}
}
