using System;
using AutoMapper;
using InventoryTraker.Web.Core;
using InventoryTraker.Web.Models;
using NUnit.Framework;

namespace InventoryTraker.Web.Tests.Models
{
	[TestFixture]
	public class InventoryAddFormTests
	{
		private IMapper _mapper;

		[OneTimeSetUp]
		public void StartUp()
		{
			_mapper = AutoMapperConfig.Config.CreateMapper();
		}

		[Test]
		public void Convert()
		{
			var form = new InventoryAddForm
			{
				AddedDate = DateTime.Today,
				ShredReadyDate = DateTime.Today.AddDays(3),
				Memo = "My Memo"
			};

			var inventory = _mapper.Map<Inventory>(form);

			Assert.That(inventory.AddedDate, Is.EqualTo(form.AddedDate));
			Assert.That(inventory.ShredReadyDate, Is.EqualTo(form.ShredReadyDate));
			Assert.That(inventory.Memo, Is.EqualTo(form.Memo));
		}
	}
}