Admin import functional

This commit is contained in:
2014-02-02 10:19:02 -05:00
parent 13c5c6cde5
commit 3ab80e283a
41 changed files with 2809 additions and 101 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,18 @@
using System.IO;
using MileageTraker.Web.DAL;
using NUnit.Framework;
namespace Web.Tests.DAL
{
[TestFixture]
public class LogImportTemplateWriterTests
{
[Test]
public void LogImportTemplteWriterTests()
{
var bytes = LogImportTemplateWriter.Write();
using (var fs = new FileStream("LogImport.xls", FileMode.Create))
fs.Write(bytes, 0, bytes.Length);
}
}
}
+37
View File
@@ -0,0 +1,37 @@
using System.Linq;
using MileageTraker.Web.DAL;
using NUnit.Framework;
namespace Web.Tests.DAL
{
[TestFixture]
public class LogImporterTests
{
private const string LogFolder = @"DAL\LogDocs\";
[Test]
public void Import_Gets_More_Than_One_Result()
{
var logs = LogImporter.Import(LogFolder + "Logs.xls").ToList();
Assert.That(logs.Count(), Is.GreaterThan(0));
var first = logs.First();
Assert.That(first.VehicleId, Is.EqualTo("3572"));
Assert.That(first.Date, Is.EqualTo("3/4/2013"));
}
[Test]
[ExpectedException(typeof(LogImportException))]
public void Import_Incorrect_ColumnHeaders()
{
LogImporter.Import(LogFolder + "Logs_IncorrectHeaders.xls");
}
[Test]
public void Import_TemplateTest()
{
var logs = LogImporter.Import(LogFolder + "MileageTraker_ImportTemplate.xls");
Assert.That(logs.Count(), Is.EqualTo(1));
}
}
}