예제 #1
0
        public void DeletePasswordReset_Pass()
        {
            // Arrange
            var newUser = tu.CreateUserObject();

            newPasswordReset = tu.CreatePasswordResetObject(newUser);

            //Act
            using (_db = tu.CreateDataBaseContext())
            {
                var expected = rs.CreatePasswordReset(_db, newPasswordReset);

                try
                {
                    _db.SaveChanges();
                }
                catch (Exception exception)
                {
                }

                var response = rs.DeletePasswordReset(_db, expected.ResetToken);
                try
                {
                    _db.SaveChanges();
                }
                catch (Exception exception)
                {
                }

                var result = rs.GetPasswordReset(_db, expected.ResetToken);

                //Assert
                Assert.IsNotNull(response);
                Assert.IsNull(result);
                Assert.AreEqual(response.ResetToken, expected.ResetToken);
            }
        }
예제 #2
0
        public void DeletePasswordReset_Fail()
        {
            // Arrange
            string nonexistingPasswordResetToken = "asdf";
            var    expected = nonexistingPasswordResetToken;

            //Act
            using (var _db = tu.CreateDataBaseContext())
            {
                ResetService rs       = new ResetService(_db);
                var          response = rs.DeletePasswordReset(expected);
                _db.SaveChanges();

                var result = rs.GetPasswordReset(expected);

                //Assert
                Assert.IsNull(response);
                Assert.IsNull(result);
            }
        }