Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] .NET Core with .NET CLI #51

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ packages/*
**/packages/*
*.nupkg
.nuget/*.exe
*.sln.ide
*.sln.ide
project.lock.json
11 changes: 11 additions & 0 deletions Fuchu/Fuchu.MbUnit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ module MbUnit =

let testCategory (m: MemberInfo) =
m.GetCustomAttributes(categoryAttributeType.Value, true)
#if DNXCORE50
|> Array.ofSeq
#endif
|> Array.map (fun a -> categoryAttributeNameProperty.Value.GetValue(a, null) :?> string)
|> Enumerable.FirstOrDefault

Expand Down Expand Up @@ -87,7 +90,11 @@ module MbUnit =

let testMethods = Seq.append (getTestMethods testCategory mbUnitAttrs t) rowTests

#if DNXCORE50
let test = TestToFuchu mbUnitAttrs (fun t -> t.GetTypeInfo() |> testCategory) t testMethods
#else
let test = TestToFuchu mbUnitAttrs testCategory t testMethods
#endif

let staticTests =
nonIgnoredMethods [MbUnitAttr "StaticTestFactory"]
Expand All @@ -98,5 +105,9 @@ module MbUnit =
TestList (seq {
yield test
if staticTests.Length > 0 then
#if DNXCORE50
yield testList (t.FullName + testCategory (t.GetTypeInfo())) staticTests
#else
yield testList (t.FullName + testCategory t) staticTests
#endif
})
10 changes: 10 additions & 0 deletions Fuchu/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="fsharp-daily" value="https://www.myget.org/F/fsharp-daily/api/v3/index.json" />
</packageSources>
</configuration>
32 changes: 32 additions & 0 deletions Fuchu/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "1.0.0-*",
"compilationOptions": {
},

"compilerName": "fsc",
"compileFiles": [
"AssemblyInfo.fs",
"Fuchu.fs",
"Assertions.fs",
"xUnitHelpers.fs",
"Fuchu.NUnit.fs",
"Fuchu.MbUnit.fs"
],

"frameworks": {
"net46": {
"dependencies": {
"FSharp.Core": "4.0.0.1"
}
},

"dnxcore50": {
"dependencies": {
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
"System.Diagnostics.TraceSource": "4.0.0-rc2-23811",
"System.Linq.Parallel": "4.0.1-rc2-23811",
"NETStandard.Library": "1.0.0-rc2-23811"
}
}
}
}
8 changes: 8 additions & 0 deletions Fuchu/xUnitHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ module XunitHelpers =

let nonIgnoredMethods ignoreAttr (t: Type) =
[t]
#if DNXCORE50
|> Seq.filter (fun t -> not (t.GetTypeInfo().HasAttribute ignoreAttr))
#else
|> Seq.filter (fun t -> not (t.HasAttribute ignoreAttr))
#endif
|> Seq.collect (fun _ -> t.GetMethods())

let propertyValue propertyName o =
Expand Down Expand Up @@ -59,7 +63,11 @@ module XunitHelpers =
Invoke = fun (o: obj) -> invoke o m })

let TestToFuchu (attr: TestAttributes) (testCategory: Type -> string) (testType: Type) (testMethods: TestMethod seq) =
#if DNXCORE50
if testType.GetTypeInfo().IsAbstract
#else
if testType.IsAbstract
#endif
then TestList []
else
let methods = nonIgnoredMethods attr.Ignore testType
Expand Down