예제 #1
0
        public void AddIpAddressTest()
        {
            string newAddress = "4.4.4.4/4";

            var mock            = new Mock <INetworkAddressRepository>();
            var serviceInstance = new HomeService(mock.Object);

            mock.Setup(a => a.AddIpAddressToDataBase(It.IsAny <string>())).Verifiable();

            serviceInstance.AddIpAddress(newAddress);

            mock.Verify();
            var actual = mock.Invocations.Count;


            Assert.AreEqual(1, actual);
        }