コード例 #1
0
ファイル: WmtsTests.cs プロジェクト: zblGitHub/BruTile
        public void TestWmtsRequestInParallel()
        {
            // arrange
            var resourceUrls      = CreateResourceUrls();
            var levelToIdentifier = new Dictionary <int, string> {
                [14] = "level-14"
            };
            var request  = new WmtsRequest(resourceUrls, levelToIdentifier);
            var urls     = new ConcurrentBag <Uri>(); // List is not thread save
            var tileInfo = new TileInfo {
                Index = new TileIndex(8938, 5680, 14)
            };

            // act
            var requests = new List <Func <Uri> >();

            for (var i = 0; i < 150; i++)
            {
                requests.Add(() => request.GetUri(tileInfo));
            }
            Parallel.ForEach(requests, r => urls.Add(r()));

            // assert
            var count = urls.Count(u => u.ToString() == "http://maps1.wien.gv.at/wmts/lb/farbe/google3857/level-14/5680/8938.jpeg");

            Assert.True(count == 50);
        }
コード例 #2
0
ファイル: WmtsTests.cs プロジェクト: zjwgis721/BruTile
        public void TestWmtsRequest()
        {
            // arrange
            var resourceUrls = CreateResourceUrls();
            var wmtsRequest  = new WmtsRequest(resourceUrls);

            // act
            var url1 = wmtsRequest.GetUri(new TileInfo {
                Index = new TileIndex(8938, 5680, "14")
            });
            var url2 = wmtsRequest.GetUri(new TileInfo {
                Index = new TileIndex(8938, 5680, "14")
            });

            // assert
            Assert.True(url1.ToString().Equals("http://maps1.wien.gv.at/wmts/lb/farbe/google3857/14/5680/8938.jpeg"));
            Assert.True(url2.ToString().Contains("maps2"));
        }
コード例 #3
0
ファイル: WmtsTests.cs プロジェクト: zblGitHub/BruTile
        public void TestWmtsRequest()
        {
            // arrange
            var resourceUrls      = CreateResourceUrls();
            var levelToIdentifier = new Dictionary <int, string> {
                [14] = "level-14"
            };
            var wmtsRequest = new WmtsRequest(resourceUrls, levelToIdentifier);

            // act
            var url1 = wmtsRequest.GetUri(new TileInfo {
                Index = new TileIndex(8938, 5680, 14)
            });
            var url2 = wmtsRequest.GetUri(new TileInfo {
                Index = new TileIndex(8938, 5680, 14)
            });

            // assert
            Assert.True(url1.ToString().Equals("http://maps1.wien.gv.at/wmts/lb/farbe/google3857/level-14/5680/8938.jpeg"));
            Assert.True(url2.ToString().Contains("maps2"));
        }