コード例 #1
0
        public void DeleteContact_WithExistingContact_ShouldReturnTrue()
        {
            // Arrange
            var mockContactRepository = new Mock <IContactRepository>();

            mockContactRepository.Setup(contactRepository =>
                                        contactRepository.DeleteContact(It.IsAny <Contact>())).Returns(true);
            var contactManager = new ContactManager(mockContactRepository.Object);

            // Create a fake contact
            var contact = new Contact
            {
                FirstName    = "TestUserFirstName",
                LastName     = "TestUserLastName",
                EmailAddress = "*****@*****.**",
                Birthday     = DateTime.Now
            };

            // Act
            var wasDeleted = contactManager.DeleteContact(contact);

            // Assert
            Assert.True(wasDeleted);
        }
コード例 #2
0
 public ActionResult Delete(int id)
 {
     manager.DeleteContact(id);
     return(RedirectToAction("Index"));
 }
コード例 #3
0
 //Delete Contact
 public string DeleteContact(int _Id)
 {
     return(_ContactManager.DeleteContact(_Id).ToString());
 }
コード例 #4
0
 public static void DeleteContactDto(int id)
 {
     ContactManager.DeleteContact(id);
 }