コード例 #1
0
        public void Create_Post_PutsValidContactIntoRepository()
        {
            var repository = new InMemoryContactRepository();
            var controller = GetHomeController(repository);
            var contact    = GetContact(Guid.NewGuid(), "", "");

            controller.Create(contact);

            IEnumerable <Contact> contacts = repository.GetAllContacts();

            Assert.IsTrue(contacts.Contains(contact));
        }
コード例 #2
0
        public void Create_Post_PutsValidContactIntoRepository()
        {
            // Arrange
            InMemoryContactRepository repository = new InMemoryContactRepository();
            HomeController            controller = GetHomeController(repository);
            Contact contact = GetContactID_1();

            // Act
            controller.Create(contact);

            // Assert
            IEnumerable <Contact> contacts = repository.GetAllContacts();

            Assert.IsTrue(contacts.Contains(contact));
        }