using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MileageTraker.Web.DAL;
using NUnit.Framework;

namespace Web.Tests.DAL
{
	[TestFixture]
	public class UserImporterTests
	{
		[Test]
		public void Import_Gets_More_Than_One_Result()
		{
			var users = UserImporter.Import("DAL\\UserEmails.xls");

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

		[Test]
		public void Import_Disabled_Users()
		{
			var users = UserImporter.Import("DAL\\UserEmails.xls");
			var jlawson = users.Find(u => u.Username == "jlawson");
			Assert.That(jlawson.IsApproved, Is.False);
		}

		[Test]
		public void Import_Gets_All_Fields()
		{
			var users = UserImporter.Import("DAL\\UserEmails.xls");
			var dsloan = users.Find(u => u.Username == "dsloan");
			Assert.That(dsloan.Username, Is.EqualTo("dsloan"));
			Assert.That(dsloan.FullName, Is.EqualTo("David Sloan"));
			Assert.That(dsloan.Email, Is.EqualTo("dsloan@ethra.org"));
			Assert.That(dsloan.IsApproved, Is.True);
		}
	}
}
