Skip to content

Commit

Permalink
Tests for nullable email
Browse files Browse the repository at this point in the history
  • Loading branch information
FoC- committed Jul 30, 2012
1 parent 19c7f39 commit 7a04978
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
1 change: 1 addition & 0 deletions MongoMembership.Tests/MongoMembership.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Compile Include="Mongo\CreateUser_when_called.cs" />
<Compile Include="Mongo\GetById_when_called.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Providers\MembershipProvider\When_CreateUser_is_caled_and_email_is_null.cs" />
<Compile Include="StubsBase.cs" />
<Compile Include="Providers\MembershipProvider\When_FindUsersByName_is_called_and_user_exist_in_db.cs" />
<Compile Include="When_initilized.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Web.Security;
using Machine.Specifications;
using MongoMembership.Providers;

namespace MongoMembership.Tests.Providers.MembershipProvider
{
[Subject(typeof(MongoMembershipProvider))]
class When_CreateUser_is_caled_and_email_is_null : StubsBase
{
Establish context = () =>
{
username = "name";
provider = CreateProvider();
};

Because of = () =>
{
MembershipCreateStatus status;
user = provider.CreateUser(username, "pass", null, null, null, true, "dfg1dr3", out status);
};

It should_return_user = () =>
{
user.ShouldNotBeNull();
};

It should_return_user_with_same_name = () =>
{
user.UserName.ShouldEqual(username);
};

Cleanup staff = () =>
{
provider.DeleteUser(username, true);
};

private static MembershipUser user;
private static MongoMembershipProvider provider;
private static string username;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace MongoMembership.Tests.Providers.MembershipProvider
{
[Subject(typeof(MongoMembershipProvider))]
class When_FindUsersByName_is_called_and_user_exist_in_db : StubsBase
{
private Establish context = () =>
Expand All @@ -29,13 +30,7 @@ class When_FindUsersByName_is_called_and_user_exist_in_db : StubsBase

private Cleanup staff = () =>
{
int total;
MembershipUserCollection allUsers = provider.GetAllUsers(1, 100, out total);

foreach (MembershipUser user in allUsers)
{
provider.DeleteUser(user.UserName, true);
}
provider.DeleteUser(userName, true);
};

private static MembershipUserCollection users;
Expand Down

0 comments on commit 7a04978

Please sign in to comment.