コード例 #1
0
        public void DeteUser_Should_Delete_ApropriateUser()
        {
            // Arrange
            var repository   = new TestUserRepository();
            var userToDelete = repository.GetUser(1);

            // Act
            repository.DeleteUser(userToDelete);
            var userDeleted = repository.GetUser(1);

            // Assert
            Assert.AreEqual(repository.GetAllUsers().Count(), 14);
            Assert.IsNull(userDeleted);
        }
コード例 #2
0
        public void DeteUser_Should_ThrowExceptionFor_InvalidUser()
        {
            // Arrange
            var repository   = new TestUserRepository();
            var userToDelete = new User()
            {
                UserID = 22
            };

            // Act
            try
            {
                repository.DeleteUser(userToDelete);
                Assert.Fail();
            }
            catch (Exception ex) {}
        }