Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from RockLib/dotnet_5
Browse files Browse the repository at this point in the history
Add net5.0 as a target, upgrade tests to net5.0
  • Loading branch information
JustinMoss committed Nov 24, 2020
2 parents d506424 + aab23db commit 6a6ffe6
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 22 deletions.
25 changes: 15 additions & 10 deletions RockLib.Threading.Tests/RockLib.Threading.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="4.19.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170727-01" />
<PackageReference Include="xunit" Version="2.3.0-beta3-build3705" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta3-build3705" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\RockLib.Threading\RockLib.Threading.csproj" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
</Project>
29 changes: 20 additions & 9 deletions RockLib.Threading.Tests/SoftlockTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,40 @@ namespace RockLib.Threading.Tests
{
public class SoftlockTests
{
[Fact]
public void IsLockAcquired_WillReturnTrue_WhenPriorLockHasBeenAcquired()
[Fact(DisplayName = "TryAcquire method sets IsLockAckquired property to true")]
public void TryAcquireTest1()
{
var softlock = new SoftLock();

// Prove that the lock is not acquired initially
softlock.IsLockAcquired.Should().BeFalse();

// This will set the lock to true
softlock.TryAcquire();

softlock.IsLockAcquired.Should().BeTrue();
}

[Fact]
public void IsLockAcquired_WillReturnFalse_WhenPriorLockHasNotBeenAcquired()
[Fact(DisplayName = "TryAcquire returns true when the lock is acquired")]
public void TryAcquireTest2()
{
var softlock = new SoftLock();

// call nothing, should be false by default
softlock.TryAcquire().Should().BeTrue();
}

softlock.IsLockAcquired.Should().BeFalse();
[Fact(DisplayName = "TryAcquire returns false when the lock has already been acquired")]
public void TryAcquireTest3()
{
var softlock = new SoftLock();

softlock.TryAcquire();

softlock.TryAcquire().Should().BeFalse();
}

[Fact]
public void Release_WillReleaseExistingLock_WillSignalByIsLockAcquired()
[Fact(DisplayName = "Release method sets IsLockAcquired property back to false")]
public void ReleaseTest()
{
var softlock = new SoftLock();

Expand All @@ -40,6 +51,6 @@ public void Release_WillReleaseExistingLock_WillSignalByIsLockAcquired()

// verify it has been released
softlock.IsLockAcquired.Should().BeFalse();
}
}
}
}
4 changes: 2 additions & 2 deletions RockLib.Threading.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2009
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RockLib.Threading", "RockLib.Threading\RockLib.Threading.csproj", "{5421475F-E68A-44DD-8746-8FE14451A913}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion RockLib.Threading/RockLib.Threading.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard1.6;net45;net40;net35;</TargetFrameworks>
<TargetFrameworks>net5.0;netstandard2.0;netstandard1.6;net45;net40;net35;</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 6a6ffe6

Please sign in to comment.