コード例 #1
0
        public void CreateUserTestPass()
        {
            /*
             * The goal of this test is to successfully create a user.
             */

            try
            {

                var user = new User
                               {
                                   EMailAddress = "*****@*****.**",
                                   FirstName = "Bob",
                                   LastName = "Marley",
                                   PurchaseCount = 12,
                                   AccountCreateDate = DateTime.Now
                               };

                user.Create();

                var result = User.GetUserByEmailAddress("*****@*****.**");
                Assert.IsTrue(result != null);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #2
0
        public void CreateUserTestFail()
        {
            /*
             * Execute CreateUserTestPass first.
             * The goal of this test is to successfully create a user.
             */

            try
            {

                var user = new User
                {
                    EMailAddress = "*****@*****.**",
                    FirstName = "Bob",
                    LastName = "Marley",
                    AccountCreateDate = DateTime.Now
                };

                user.Create();
                Assert.Fail("User was successfully created this should have failed.");
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.Message.Contains("exists"),ex.Message);
            }
        }