public void TestMethod1() { var mockRepository = new Mock <IAddressRepository>(); mockRepository.Setup(m => m.FindById(1)).Returns(new Address { Name = "aaaa" }); var contlloer = new AddressController(mockRepository.Object); Assert.IsTrue(contlloer.CheckNameById("aaaa", 1)); }