Walter.Web.FireWall
SetOptions Method
Example 
Walter.Web.FireWall Assembly > Walter.Web.FireWall.Geo Namespace > IGeoFactory Interface : SetOptions Method
ensures that the options for the GEO provider are applied
Syntax
void SetOptions()
Example
The following samples shows how to use DI to create a functional firewall that can be used to UNIT test your code
[ClassInitialize]
             public static void ClassInitialize(TestContext context)
             {
                 var conf = new FireWallConfig(FireWallTrial.License, FireWallTrial.DomainKey, new System.Uri("https://localhost:5001", System.UriKind.Absolute))
                 {
                     AppDataFolder = datafolder,
            
                 };
                 conf.Geography.DataDetailLevels = GeoDataDetailLevels.County | GeoDataDetailLevels.City;
                 conf.Geography.UseMethod = GeoMethod.UseFile;
                 conf.Geography.ConnectionString = @"D:\MaxMind";
                 conf.Geography[ContentType.GeoData.ToString()]  = Path.Combine(conf.Geography.ConnectionString, "GeoLite2-Country.mmdb");
                 conf.Geography[ContentType.CityData.ToString()] = Path.Combine(conf.Geography.ConnectionString, "GeoLite2-City.mmdb");
            
                 DIContainer.SetDefaultInstance<IFireWallConfig>(conf);
                 var state = new DbState("dbo", "Data Source=LocalHost;Initial Catalog=AspWafFireWallState;Integrated Security=True;", TimeSpan.FromDays(365 * 3));
                 DIContainer.SetDefaultInstance<DbState>(state);
                 conf.Cashing.BufferFirewallData = TimeSpan.FromSeconds(3);
                 var serviceProvider = new ServiceCollection()
                                     .AddLogging()
                                     .AddMemoryCache()
                                     .AddSingleton<IFireWallConfig>(conf)
                                     .AddSingleton(typeof(IFireWall), typeof(MyFireWall))
                                     .AddSingleton(typeof(ILatLongRepository),typeof(MaxMindRepository))
                                     .BuildServiceProvider();
                 DIContainer.ServiceProvider = serviceProvider;
            
             }
            
             [TestMethod()]
             public void FlushTest()
             {
                 var firewall = DIContainer.GetDefaultInstance<IFireWall>();
                 // your test
            
             }
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IGeoFactory Interface
IGeoFactory Members