From 7a04978d1b3a8a40bcdd43982f2c49cb19df9ae1 Mon Sep 17 00:00:00 2001 From: FoC- Date: Mon, 30 Jul 2012 22:45:50 +0300 Subject: [PATCH] Tests for nullable email --- .../MongoMembership.Tests.csproj | 1 + ...n_CreateUser_is_caled_and_email_is_null.cs | 41 +++++++++++++++++++ ...rsByName_is_called_and_user_exist_in_db.cs | 9 +--- 3 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 MongoMembership.Tests/Providers/MembershipProvider/When_CreateUser_is_caled_and_email_is_null.cs diff --git a/MongoMembership.Tests/MongoMembership.Tests.csproj b/MongoMembership.Tests/MongoMembership.Tests.csproj index 54723c3..814f91b 100644 --- a/MongoMembership.Tests/MongoMembership.Tests.csproj +++ b/MongoMembership.Tests/MongoMembership.Tests.csproj @@ -51,6 +51,7 @@ + diff --git a/MongoMembership.Tests/Providers/MembershipProvider/When_CreateUser_is_caled_and_email_is_null.cs b/MongoMembership.Tests/Providers/MembershipProvider/When_CreateUser_is_caled_and_email_is_null.cs new file mode 100644 index 0000000..e7e11b3 --- /dev/null +++ b/MongoMembership.Tests/Providers/MembershipProvider/When_CreateUser_is_caled_and_email_is_null.cs @@ -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; + } +} \ No newline at end of file diff --git a/MongoMembership.Tests/Providers/MembershipProvider/When_FindUsersByName_is_called_and_user_exist_in_db.cs b/MongoMembership.Tests/Providers/MembershipProvider/When_FindUsersByName_is_called_and_user_exist_in_db.cs index a83ae26..bdc0508 100644 --- a/MongoMembership.Tests/Providers/MembershipProvider/When_FindUsersByName_is_called_and_user_exist_in_db.cs +++ b/MongoMembership.Tests/Providers/MembershipProvider/When_FindUsersByName_is_called_and_user_exist_in_db.cs @@ -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 = () => @@ -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;