public async Task IGeoliteClientPullsGeoliteDatabaseInTestDirectory()
        {
            var root          = hostEnvironment.ContentRootPath;
            var testDirectory = Path.Combine(root, "GeoliteTest");

            // will create if does not exists & won't create if exist
            Directory.CreateDirectory(testDirectory);

            string geoliteDbpath = await geoliteClient.PullGeoliteDataBaseAsync(testDirectory);

            Assert.True(geoliteDbpath != null, "Geolite db file path should not be null");
            Assert.True(geoliteDbpath.Contains(testDirectory), "DB file path should be in our specified destination directory");
            Assert.True(File.Exists(geoliteDbpath), "Geolite DB should exist");

            // I decided to delete testDirectory
            // But, if you want to check Database file in testDirectory, just comment below line
            Directory.Delete(testDirectory, true);
        }
示例#2
0
        private async Task <string> GetTestDbGzipFileAsync(string directoryName)
        {
            var root          = hostEnvironment.ContentRootPath;
            var testDirectory = Path.Combine(root, directoryName);

            // will create if does not exists & won't create if exist
            Directory.CreateDirectory(testDirectory);

            string geoliteDbGzipPath = await geoliteClient.PullGeoliteDataBaseAsync(testDirectory);

            return(geoliteDbGzipPath);
        }