예제 #1
0
        public void ReadDefaultWmtsConnectionInfos_Always_ReturnsExpectedWmtsConnectionInfos()
        {
            // Setup
            var reader = new WmtsConnectionInfoReader();

            // Call
            ReadOnlyCollection <WmtsConnectionInfo> readConnectionInfos = reader.ReadDefaultWmtsConnectionInfos();

            // Assert
            Assert.AreEqual(2, readConnectionInfos.Count);
            var firstExpected  = new WmtsConnectionInfo(@"ESRI luchtfoto", @"http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS?");
            var secondExpected = new WmtsConnectionInfo(@"PDOK", @"https://geodata.nationaalgeoregister.nl/tiles/service/wmts/ahn2?request=GetCapabilities");

            AssertAreEqual(firstExpected, readConnectionInfos[0]);
            AssertAreEqual(secondExpected, readConnectionInfos[1]);
        }
예제 #2
0
        private IEnumerable <WmtsConnectionInfo> GetSavedWmtsConnectionInfos()
        {
            var reader = new WmtsConnectionInfoReader();

            if (!File.Exists(wmtsConnectionInfoFilePath))
            {
                return(reader.ReadDefaultWmtsConnectionInfos());
            }

            try
            {
                return(reader.ReadWmtsConnectionInfos(wmtsConnectionInfoFilePath));
            }
            catch (CriticalFileReadException exception)
            {
                log.Error(exception.Message, exception);
            }

            return(Enumerable.Empty <WmtsConnectionInfo>());
        }