コード例 #1
0
        public void Test_To_Get_All_Contact_From_Repository()
        {
            // Arrange
            tbl_contact contact1 = GetContactName(1, "John", "Doe", "*****@*****.**", "987654321", true);
            tbl_contact contact2 = GetContactName(2, "John1", "Doe1", "*****@*****.**", "987654312", true);
            InMemoryContactRepository inMemoryContactRepository = new InMemoryContactRepository();

            inMemoryContactRepository.InsertContact(contact1);
            inMemoryContactRepository.InsertContact(contact2);
            var controller = GetContactController(inMemoryContactRepository);
            var result     = controller.Index();
            var datamodel  = (List <tbl_contact>)result.ViewData.Model;

            CollectionAssert.Contains(datamodel.ToArray(), contact1);
            CollectionAssert.Contains(datamodel.ToArray(), contact2);
        }