using System;
using System.IO;
using System.Linq;
using ExcelLibrary.SpreadSheet;
using MileageTraker.Web.DAL;
using NUnit.Framework;

namespace Web.Tests.DAL
{
	[TestFixture]
	public class VehicleImporterTests
	{
		[Test]
		public void Import_Gets_More_Than_One_Result()
		{
			var vehicles = VehicleImporter.Import("DAL\\Vehicles.xls");

			Assert.That(vehicles.Count(), Is.GreaterThan(0));
		}

		[Test]
		public void Export_Saves_A_File()
		{
			var vehicles = VehicleImporter.Import("DAL\\Vehicles.xls");
			const string filename = @"VehiclesExport.xls";
			VehicleImporter.Export(vehicles, filename);
			Assert.That(File.Exists(filename));
			File.Delete(filename);
		}
	}
}
