Skip to content

Commit fd7238a

Browse files
committed
add tests for type provider
1 parent 24e0b17 commit fd7238a

5 files changed

Lines changed: 40 additions & 1 deletion

File tree

build/PackageTasks.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ let pack = BuildTask.create "Pack" [clean; build; runTests] {
2929
"Version",stableVersionTag
3030
"PackageReleaseNotes", (release.Notes |> List.map replaceCommitLink |> String.concat "\r\n" )
3131
] @ p.MSBuildParams.Properties)
32+
DisableInternalBinLog = true
3233
}
3334
{
3435
p with
@@ -51,6 +52,7 @@ let packPrerelease = BuildTask.create "PackPrerelease" [setPrereleaseTag; clean;
5152
"Version", prereleaseTag
5253
"PackageReleaseNotes", (release.Notes |> List.map replaceCommitLink |> String.toLines )
5354
] @ p.MSBuildParams.Properties)
55+
DisableInternalBinLog = true
5456
}
5557
{
5658
p with

build/TestTasks.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ let runTests = BuildTask.create "RunTests" [clean; build] {
1515
Logger = Some "console;verbosity=detailed"
1616
Configuration = DotNet.BuildConfiguration.fromString configuration
1717
NoBuild = true
18+
MSBuildParams = {
19+
testParams.MSBuildParams with
20+
DisableInternalBinLog = true
21+
}
1822
}
1923
) testProject
2024
)
@@ -35,6 +39,7 @@ let runTestsWithCodeCov = BuildTask.create "RunTestsWithCodeCov" [clean; build]
3539
"AltCoverCobertura","../../codeCov.xml"
3640
"AltCoverForce","true"
3741
]
42+
DisableInternalBinLog = true
3843
};
3944
Logger = Some "console;verbosity=detailed"
4045
}

playground.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let [<Literal>] oboPath = @"C:\Users\schne\source\repos\CSBiology\OBO.NET\tests\
1717

1818
type go = OboTermsProvider<oboPath>
1919

20-
go.``adult gena``
20+
go.``adult gena``.Synonyms.Length
2121

2222
//open OBO.NET.CodeGeneration
2323

tests/OBO.NET.Tests/OBO.NET.Tests.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12+
<None Include="References\go.obo" />
1213
<None Include="References\IncorrectHeaderTags.obo" />
1314
<None Include="References\DuplicateHeaderTags.obo" />
1415
<None Include="references\CorrectHeaderTags.obo" />
1516
<Compile Include="DBXref.Tests.fs" />
1617
<Compile Include="TermSynonym.Tests.fs" />
1718
<Compile Include="OboTerm.Tests.fs" />
1819
<Compile Include="OboOntology.Tests.fs" />
20+
<Compile Include="TypeProviderTests.fs" />
1921
<Compile Include="Main.fs" />
2022
</ItemGroup>
2123

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
namespace OBO.NET.Tests
2+
3+
open OBO.NET
4+
open OboProvider
5+
6+
open Expecto
7+
8+
open System
9+
open System.IO
10+
11+
module TypeProviderTests =
12+
13+
// use this for in-IDE support.
14+
//let [<Literal>] oboPath = @"tests/OBO.NET.Tests/References/go.obo"
15+
16+
// use this for performing the test execution
17+
let [<Literal>] oboPath = @"References/go.obo"
18+
19+
type go = OboTermsProvider<oboPath>
20+
21+
[<Tests>]
22+
let oboOntologyTest =
23+
testList "OboProvider" [
24+
test "go term 'adult gena' is provided" {
25+
let actual = go.``adult gena``
26+
Expect.equal actual.Id "TGMA:0000031" "Expected term ID for 'adult gena' to be TGMA:0000031"
27+
Expect.equal actual.Name "adult gena" "Expected term name for 'adult gena' to be 'adult gena'"
28+
Expect.equal actual.Synonyms.Length 7 "Expected 'adult gena' to have 7 synonyms"
29+
}
30+
]

0 commit comments

Comments
 (0)