CreateUser() public method

public CreateUser ( RegisterModel model ) : MembershipCreateStatus
model RegisterModel
return MembershipCreateStatus
        public void CreateUserTest2()
        {
            FelBookDBEntities db = new FelBookDBEntities();
            IMembershipService MembershipService = new FelbookAccountMembershipService(db);
            MembershipCreateStatus result;

            // vytvoření duplicateUser
            User user = User.CreateUser(0, "Ota", "Sandr",
                DateTime.Now, "mail", "duplicateUser", "");
            user.ChangePassword("good password");
            db.UserSet.AddObject(user);
            db.SaveChanges();

            result = MembershipService.CreateUser("duplicateUser", "password", "*****@*****.**");
            Assert.AreEqual(MembershipCreateStatus.DuplicateUserName, result);

            // smazání duplicateUser
            db.UserSet.DeleteObject(user);
            db.SaveChanges();

            // zálohování normalUser

            result = MembershipService.CreateUser("normalUser", "password", "*****@*****.**");
            Assert.AreEqual(MembershipCreateStatus.Success, result);

            // smazání normalUser a případná obnova zálohy
            User user2 = db.UserSet.Single(u => u.Username == "normalUser");
            db.UserSet.DeleteObject(user2);
            db.SaveChanges();
        }
        public void CreateUserTest1()
        {
            FelBookDBEntities db = new FelBookDBEntities();
            IMembershipService MembershipService = new FelbookAccountMembershipService(db);

            #region usernameTests
            try
            {
                MembershipService.CreateUser(null, "some password", "some email");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: userName", ex.Message);
            }

            try
            {
                MembershipService.CreateUser("", "some password", "some email");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: userName", ex.Message);
            }
            #endregion

            #region passwordTests
            try
            {
                MembershipService.CreateUser("some username", null, "some email");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: password", ex.Message);
            }

            try
            {
                MembershipService.CreateUser("some username", "", "some email");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: password", ex.Message);
            }
            #endregion

            #region emailTests
            try
            {
                MembershipService.CreateUser("some username", "some password", null);
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: email", ex.Message);
            }

            try
            {
                MembershipService.CreateUser("some username", "some password", "");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: email", ex.Message);
            }
            #endregion

            try
            {
                MembershipService.CreateUser("some username", "some password", "some email");
                User user = db.UserSet.Single(u => u.Username == "some username");
                db.UserSet.DeleteObject(user);
                db.SaveChanges();
            }
            catch (ArgumentException)
            {
                Assert.Fail();
            }
        }