예제 #1
0
        public void TestGetGeopointBlank()
        {
            Mock <IGeopointManager> geoPointManagerMock = new Mock <IGeopointManager>(MockBehavior.Strict);

            AddressValidation addressValidation = new AddressValidation(geoPointManagerMock.Object);

            GeoPoint result = addressValidation.GetGeopoint(new Address());

            geoPointManagerMock.Verify(a => a.GetGeopoint(It.IsAny <string>()), Times.Never);
            Assert.AreEqual(0, result.Latitude);
            Assert.AreEqual(0, result.Longitude);
        }
예제 #2
0
        public void TestGetGeopoint()
        {
            Mock <IGeopointManager> geoPointManagerMock = new Mock <IGeopointManager>(MockBehavior.Strict);

            geoPointManagerMock.Setup(a => a.GetGeopoint(It.IsAny <string>())).Returns(new MapPoint()
            {
                Longitude = 10,
                Latitude  = 10
            });

            AddressValidation addressValidation = new AddressValidation(geoPointManagerMock.Object);

            GeoPoint result = addressValidation.GetGeopoint(new Address()
            {
                Street = "here",
                City   = "there",
                State  = States.AK.ToString(),
                Zip    = "12345"
            });

            geoPointManagerMock.Verify(a => a.GetGeopoint(It.IsAny <string>()), Times.Once);
            Assert.IsNotNull(result.Latitude);
            Assert.IsNotNull(result.Longitude);
        }