Skip to content

Commit

Permalink
polish 1
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmaturtle committed Jun 30, 2023
1 parent 20f15df commit d222d68
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 41 deletions.
8 changes: 4 additions & 4 deletions examples/csharp-examples/DocumentationSamples.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Hedgehog;
using Hedgehog;
using Hedgehog.Linq;
using Hedgehog.Xunit;
using Microsoft.FSharp.Core;
Expand Down Expand Up @@ -87,7 +87,7 @@ public static AutoGenConfig _(
public bool This_also_passes(string s, int i) =>
s == "foo" && i == 13;

internal static Task Fast()
internal static Task FooAsync()
{
return Task.CompletedTask;
}
Expand All @@ -96,7 +96,7 @@ internal static Task Fast()
public async Task Async_Task_property(
int i)
{
await Fast();
await FooAsync();
Assert.True(i == i);
}

Expand All @@ -111,7 +111,7 @@ public Task Task_property(
[Property]
public async Task<bool> Async_boolean(bool i)
{
await Fast();
await FooAsync();
return i || !i;
}

Expand Down
6 changes: 3 additions & 3 deletions examples/csharp-examples/csharp-examples.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>csharp_examples</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -10,13 +10,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 7 additions & 3 deletions examples/fsharp-examples/fsharp-examples.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>fsharp_examples</RootNamespace>

<IsPackable>false</IsPackable>
Expand All @@ -13,13 +13,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -29,4 +29,8 @@
<ProjectReference Include="..\..\src\Hedgehog.Xunit\Hedgehog.Xunit.fsproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="7.0.300" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions readmeCSharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ Rerun a particular test case.
* Async and not async `Task<Boolean>` are also considered properties

```CSharp
internal static Task Fast()
internal static Task FooAsync()
{
return Task.CompletedTask;
}

[Property]
public async Task<bool> Async_boolean(bool i)
{
await Fast();
await FooAsync();
return i || !i;
}

Expand Down Expand Up @@ -147,7 +147,7 @@ Rerun a particular test case.
* If the property returns task it is considered a property and should throw an exception if the test fails

```CSharp
internal static Task Fast()
internal static Task FooAsync()
{
return Task.CompletedTask;
}
Expand All @@ -156,7 +156,7 @@ Rerun a particular test case.
public async Task Async_Task_property(
int i)
{
await Fast();
await FooAsync();
Assert.True(i == i);
}

Expand Down
37 changes: 16 additions & 21 deletions tests/Hedgehog.Xunit.CSharp.Tests/Async.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
using System.Threading.Tasks.Sources;
using Hedgehog.Linq;

namespace Hedgehog.Xunit.CSharp.Tests;
namespace Hedgehog.Xunit.CSharp.Tests;

public class Async
{
internal static Task Fast()
{
return Task.CompletedTask;
}
internal static Task FooAsync() => Task.CompletedTask;

[Property]
public async Task Async_property_which_returns_task_can_run(
int i)
{
await Fast();
Assert.True(i == i);
}
[Property]
public async Task Async_property_which_returns_task_can_run(
int i)
{
await FooAsync();
Assert.True(i == i);
}

[Property]
public async Task<bool> Async_property_which_returns_boolean_task_can_run(bool i)
{
await Fast();
return i || !i;
}
[Property]
public async Task<bool> Async_property_which_returns_boolean_task_can_run(
bool i)
{
await FooAsync();
return i || !i;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -11,13 +10,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions tests/Hedgehog.Xunit.Tests/PropertyTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ module ``Asynchronous tests`` =
| _ -> failwith "impossible"

open System.Threading.Tasks
let Fast() =
let FooAsync() =
Task.CompletedTask

[<Property(Skip = skipReason)>]
Expand All @@ -358,7 +358,7 @@ module ``Asynchronous tests`` =
[<Property(Skip = skipReason)>]
let ``TaskBuilder (returning Task<unit>) with exception shrinks, skipped`` (i: int) : Task<unit> =
task {
do! Fast()
do! FooAsync()
if i > 10 then
raise <| Exception()
}
Expand Down

0 comments on commit d222d68

Please sign in to comment.