Exemplo n.º 1
0
        public void Test_GeoCodeMatcher_SameLatitude_LongitudeOutside200_Expect_Return_Matched()
        {
            Property agencyProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 105
            };

            Property databaseProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 107 // should be 222, outside 200, expect false
            };

            IPropertyMatcher propertyMatcher = new GeoCodeMatcher();

            bool isMatch = propertyMatcher.IsMatch(agencyProperty, databaseProperty);

            Assert.IsFalse(isMatch);
        }
Exemplo n.º 2
0
        public void Test_GeoCodeMatcher_DifferentLatitudeLongiture_1degreedifference_Expect_Return_Matched()
        {
            Property agencyProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 100
            };

            Property databaseProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 101,
                Longitude = 101
            };

            // Distance should be squareroot (1 * 1 + 1 * 1) * 111 = 156km: within 200km

            IPropertyMatcher propertyMatcher = new GeoCodeMatcher();

            bool isMatch = propertyMatcher.IsMatch(agencyProperty, databaseProperty);

            Assert.IsTrue(isMatch);
        }
Exemplo n.º 3
0
        public void Test_GeoCodeMatcher_DifferentLatitudeLongiture_2degreedifference_Expect_Return_Matched()
        {
            Property agencyProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 100
            };

            Property databaseProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 102,
                Longitude = 102
            };

            // Distance should be squareroot (2 * 2 + 2 * 2) * 111 = 222km: outside 200km

            IPropertyMatcher propertyMatcher = new GeoCodeMatcher();

            bool isMatch = propertyMatcher.IsMatch(agencyProperty, databaseProperty);

            Assert.IsFalse(isMatch);
        }
Exemplo n.º 4
0
        public void Test_GeoCodeMatcher_SameLatitude_LongitudeWithin200_Expect_Return_Matched()
        {
            Property agencyProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 105
            };

            Property databaseProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 106 // should be 111, within 200
            };

            IPropertyMatcher propertyMatcher = new GeoCodeMatcher();

            bool isMatch = propertyMatcher.IsMatch(agencyProperty, databaseProperty);

            Assert.IsTrue(isMatch);
        }
Exemplo n.º 5
0
        public void Test_GeoCodeMatcher_SameLocation_SameAgencyCode_Expect_Return_Matched()
        {
            Property agencyProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 105
            };

            Property databaseProperty = new Property
            {
                AgencyCode = "LRE",
                Latitude = 100,
                Longitude = 105
            };

            IPropertyMatcher propertyMatcher = new GeoCodeMatcher();

            bool isMatch = propertyMatcher.IsMatch(agencyProperty, databaseProperty);

            Assert.IsTrue(isMatch);
        }