-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Net 8 upgrade, NetFramework test project added, HttpClient test added
- Loading branch information
Showing
5 changed files
with
133 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33122.133 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GeoblockingMiddleware", "src\GeoblockingMiddleware\GeoblockingMiddleware.fsproj", "{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}" | ||
EndProject | ||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GeoblockingMiddleware.Tests", "src\GeoblockingMiddleware.Tests\GeoblockingMiddleware.Tests.fsproj", "{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {274579CD-0A3B-4588-BF7B-417C8264483E} | ||
EndGlobalSection | ||
EndGlobal | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33122.133 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "GeoblockingMiddleware", "src\GeoblockingMiddleware\GeoblockingMiddleware.fsproj", "{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}" | ||
EndProject | ||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "GeoblockingMiddleware.Tests", "src\GeoblockingMiddleware.Tests\GeoblockingMiddleware.Tests.fsproj", "{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}" | ||
EndProject | ||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "GeoblockingMiddlewareFrameworkTest", "src\GeoblockingMiddleware.FrameworkTest\GeoblockingMiddlewareFrameworkTest.fsproj", "{67B5747B-200D-4E57-8E46-9810C3607077}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0AC1014E-B6C5-4B5B-A1BF-68CC0889EC71}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{BAF74CB6-8536-4727-83D0-0DBC5ACD6097}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{67B5747B-200D-4E57-8E46-9810C3607077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{67B5747B-200D-4E57-8E46-9810C3607077}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{67B5747B-200D-4E57-8E46-9810C3607077}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{67B5747B-200D-4E57-8E46-9810C3607077}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {274579CD-0A3B-4588-BF7B-417C8264483E} | ||
EndGlobalSection | ||
EndGlobal |
34 changes: 34 additions & 0 deletions
34
src/GeoblockingMiddleware.FrameworkTest/GeoblockingMiddlewareFrameworkTest.fsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
|
||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<WarnOn>3390;$(WarnOn)</WarnOn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Tests.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FsUnit.xUnit" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> | ||
<PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="4.2.2" /> | ||
<PackageReference Include="Microsoft.Owin.Hosting" Version="4.2.2" /> | ||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" /> | ||
<PackageReference Update="FSharp.Core" Version="8.0.200" /> | ||
<PackageReference Include="xunit.runner.console" Version="2.7.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\GeoblockingMiddleware\GeoblockingMiddleware.fsproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
namespace GeoblockingMiddleware.FrameworkTest | ||
|
||
|
||
open System | ||
open System.Threading | ||
open System.Threading.Tasks | ||
open GeoblockingMiddleware | ||
open Owin | ||
open Xunit | ||
open System | ||
open FsUnitTyped | ||
|
||
type MyStartup() = | ||
member __.Configuration(app:Owin.IAppBuilder) = | ||
app.UseGeoblocking(Common.defaultConfig) |> ignore | ||
() | ||
|
||
module GeoTestClass = | ||
|
||
[<Fact>] | ||
let ``Should be blocked: ApiPaths hit blocked (net48)`` () = | ||
task { | ||
let config = | ||
{ GeoblockingMiddleware.Common.defaultConfig with | ||
//Example: | ||
Countries = AllowedItems [ "XX" ] | ||
ApiPaths = BlockedItems [ "/mypath"; "/test2" ] | ||
Service = Disabled } | ||
|
||
let! actualResult = Common.shouldBlock config "0.0.0.1" "http://myserver/mypath/thing.aspx" | ||
actualResult |> shouldEqual true | ||
} | ||
:> Task | ||
|
||
[<Fact(Skip = "this does actual http-call")>] | ||
let ``Should be calling IpApi`` () = | ||
task { | ||
let! res = GeoblockingMiddleware.Common.serviceCallIpApi "157.24.0.105" 3000 | ||
match res with | ||
| None -> failwith "Country not gotten" | ||
| Some c -> | ||
String.IsNullOrEmpty c |> shouldEqual false | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters