Import users during migration

This commit is contained in:
2013-01-05 15:02:48 -05:00
parent 09a21d2b2d
commit f9844d0f38
8 changed files with 192 additions and 8 deletions
Binary file not shown.
+40
View File
@@ -0,0 +1,40 @@
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);
}
}
}
+4
View File
@@ -83,6 +83,7 @@
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include="DAL\UserImporterTests.cs" />
<Compile Include="DAL\VehicleImporterTests.cs" />
<Compile Include="Utility\CryptoTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -105,6 +106,9 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<Content Include="DAL\UserEmails.xls">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />