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
+51 -7
View File
@@ -1,5 +1,9 @@
using System;
using System.Linq;
using MileageTraker.Web.Models;
using MileageTraker.Web.Utility;
using MileageTraker.Web.ViewModels;
using MileageTraker.Web.ViewModels.CreateLog;
using NUnit.Framework;
namespace Web.Tests.Utility
@@ -8,7 +12,7 @@ namespace Web.Tests.Utility
public class CustomExtensionsTests
{
[Test]
public void TimeSpan_ToReadableString_Yesterday()
public void TimeSpan_ToVerboseStringHistoric_Yesterday()
{
var s = (DateTime.Today - DateTime.Today.AddDays(-1)).ToVerboseStringHistoric();
@@ -16,7 +20,7 @@ namespace Web.Tests.Utility
}
[Test]
public void TimeSpan_ToReadableString_Today()
public void TimeSpan_ToVerboseStringHistoric_Today()
{
var s = (DateTime.Today - DateTime.Today).ToVerboseStringHistoric();
@@ -24,7 +28,7 @@ namespace Web.Tests.Utility
}
[Test]
public void TimeSpan_ToReadableString_TwoDaysAgo()
public void TimeSpan_ToVerboseStringHistoric_TwoDaysAgo()
{
var s = (DateTime.Today - DateTime.Today.AddDays(-2)).ToVerboseStringHistoric();
@@ -32,7 +36,7 @@ namespace Web.Tests.Utility
}
[Test]
public void TimeSpan_ToReadableString_OneWeekAgo()
public void TimeSpan_ToVerboseStringHistoric_OneWeekAgo()
{
var s = (DateTime.Today - DateTime.Today.AddDays(-7)).ToVerboseStringHistoric();
@@ -40,7 +44,7 @@ namespace Web.Tests.Utility
}
[Test]
public void TimeSpan_ToReadableString_OneWeekOneDayAgo()
public void TimeSpan_ToVerboseStringHistoric_OneWeekOneDayAgo()
{
var s = (DateTime.Today - DateTime.Today.AddDays(-8)).ToVerboseStringHistoric();
@@ -48,7 +52,7 @@ namespace Web.Tests.Utility
}
[Test]
public void TimeSpan_ToReadableString_OneWeekTwoDaysAgo()
public void TimeSpan_ToVerboseStringHistoric_OneWeekTwoDaysAgo()
{
var s = (DateTime.Today - DateTime.Today.AddDays(-9)).ToVerboseStringHistoric();
@@ -56,11 +60,51 @@ namespace Web.Tests.Utility
}
[Test]
public void TimeSpan_ToReadableString_TwoWeeksAgo()
public void TimeSpan_ToVerboseStringHistoric_TwoWeeksAgo()
{
var s = (DateTime.Today - DateTime.Today.AddDays(-7)).ToVerboseStringHistoric();
Assert.That(s, Is.EqualTo("1 week ago"));
}
[Test]
public void Type_GetPropertyNames()
{
var propertyNames = (typeof (LogImportViewModel).GetPropertyNames()).ToList();
Assert.That(propertyNames, Has.Member("Vehicle ID"));
Assert.That(propertyNames, Has.Count.GreaterThan(5));
}
[Test]
public void Enum_ParseWithDisplayNames_Short()
{
var result = typeof (MileageLogType).ParseWithDisplayNames("Comm");
Assert.That(result, Is.EqualTo(MileageLogType.Commuting));
}
[Test]
public void Enum_ParseWithDisplayNames_Long()
{
var result = typeof (MileageLogType).ParseWithDisplayNames("Gas Purchase");
Assert.That(result, Is.EqualTo(MileageLogType.GasPurchase));
}
[Test]
public void Enum_ParseWithDisplayNames_Default()
{
var result = typeof (MileageLogType).ParseWithDisplayNames("GasPurchase");
Assert.That(result, Is.EqualTo(MileageLogType.GasPurchase));
}
[Test]
[ExpectedException(typeof(InvalidOperationException))]
public void Enum_ParseWithDisplayNames_Invalid()
{
typeof (MileageLogType).ParseWithDisplayNames("None");
}
}
}