Ejemplo n.º 1
0
        public void GetPhoneBookList_Null_Test()
        {
            var controller = new PhoneBookController();
            IHttpActionResult actionResult = controller.GetPhoneBookList("");
            var type         = actionResult.GetType();
            var expectedType = typeof(BadRequestErrorMessageResult);

            Assert.AreEqual(type.Name, expectedType.Name);
        }
Ejemplo n.º 2
0
        public void GetPhoneBookList_Test()
        {
            var PhoneBook = new Mock <IPhoneBook>();

            var controller = new PhoneBookController(PhoneBook.Object);

            var response = controller.GetPhoneBookList("ismailozbal");

            Assert.IsNotNull(response);
        }
Ejemplo n.º 3
0
        public void GetMethodTest()
        {
            Mock <IPhoneBook>    PhoneMock = new Mock <IPhoneBook>();
            List <PhoneBookTest> list      = new List <PhoneBookTest>();

            list.Add(new PhoneBookTest
            {
                Address      = "",
                MobileNo     = "",
                Name_Surname = "",
            });

            PhoneMock.Setup(a => a.GetPhoneBookList("ismailozbal")).Returns(Ok(list));

            PhoneBookController myobject = new PhoneBookController(PhoneMock.Object);

            var data = myobject.GetPhoneBookList("ismailozbal");

            Assert.AreEqual(1, 1);
        }