Skip to content
Merged
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
62 changes: 13 additions & 49 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,27 @@
name: SonarCloud
name: Analyse
on:
push:
branches:
- main
branches: [ "main" ]
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build and analyze
runs-on: windows-latest
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner

- name: Install dotnet coverage
shell: powershell
run: dotnet tool install dotnet-coverage --global
- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Top2000app_features" /o:"top2000app" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: Test
run: dotnet test --no-build --verbosity normal
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: Restore dependencies
run: dotnet restore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,8 +10,8 @@
<PackageId>RickNeeftDevelopment.Top2000App.Features.SQLite</PackageId>
<Description>Top 2000 Features package using the SQLite database</Description>
<Copyright>Copyright (c) Rick Neeft Development 2024</Copyright>
<PackageProjectUrl>https://github.com/Top2000app/data</PackageProjectUrl>
<Version>2.1.0</Version>
<PackageProjectUrl>https://github.com/Top2000app/features</PackageProjectUrl>
<Version>2.2.0</Version>
<Authors>Rick Neeft</Authors>
<Product>Top2000App</Product>
<PackageIcon>nugeticon.png</PackageIcon>
Expand All @@ -27,8 +27,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="RickNeeftDevelopment.Top2000App.Data" Version="2.1.0" />
<PackageReference Include="MediatR" Version="13.1.0" />
<PackageReference Include="RickNeeftDevelopment.Top2000App.Data" Version="2.2.0" />
<PackageReference Include="RickNeeftDevelopment.Top2000App.Features" Version="1.1.0" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Top2000.Features/Top2000.Features.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -12,7 +12,7 @@
<Description>Top 2000 Features package containing the contracts for feature implementations</Description>
<Copyright>Copyright (c) Rick Neeft Development 2024</Copyright>
<PackageProjectUrl>https://github.com/Top2000app/data</PackageProjectUrl>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
<Authors>Rick Neeft</Authors>
<Product>Top2000App</Product>
<PackageIcon>nugeticon.png</PackageIcon>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Top2000.Features.AllEditions;
using Top2000.Features.AllEditions;
using Top2000.Features.SQLite.AllEditions;

namespace Top2000.Features.SQLite.Unittests.AllEditions;
Expand All @@ -19,7 +19,7 @@ public void Editions_with_same_year_compare_as_zero()
var edition1 = new Edition { Year = 2018 };
var edition2 = new Edition { Year = 2018 };

sut.Compare(edition1, edition2).Should().Be(0);
sut.Compare(edition1, edition2).ShouldBe(0);
}

[TestMethod]
Expand All @@ -28,7 +28,7 @@ public void Edition_with_higher_year_compare_as_minus_zero()
var edition1 = new Edition { Year = 2018 };
var edition2 = new Edition { Year = 2019 };

sut.Compare(edition1, edition2).Should().Be(1);
sut.Compare(edition1, edition2).ShouldBe(1);
}

[TestMethod]
Expand All @@ -37,6 +37,6 @@ public void Edition_with_lower_year_compare_as_plus_zero()
var edition1 = new Edition { Year = 2001 };
var edition2 = new Edition { Year = 2000 };

sut.Compare(edition1, edition2).Should().Be(-1);
sut.Compare(edition1, edition2).ShouldBe(-1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public void TrackListingAreEqualWhenPositionIsTheSame()
var track1 = new TrackListing { Position = 1 };
var track2 = new TrackListing { Position = 1 };

sut.Equals(track1, track2).Should().BeTrue();
sut.Equals(track1, track2).ShouldBeTrue();
}

[TestMethod]
public void HashCodeOfTrackListingEqualsPositionHashCode()
{
var track = new TrackListing { Position = 1392 };

sut.GetHashCode(track).Should().Be(track.Position.GetHashCode());
sut.GetHashCode(track).ShouldBe(track.Position.GetHashCode());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,15 +10,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="MSTest.TestAdapter" Version="4.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="4.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void Listings_with_same_edition_compare_as_zero()

var sut = new ListingInformationDescendingComparer();

sut.Compare(listing1, listing2).Should().Be(0);
sut.Compare(listing1, listing2).ShouldBe(0);
}

[TestMethod]
Expand All @@ -25,7 +25,7 @@ public void Listings_with_higher_edition_compare_as_minus_zero()

var sut = new ListingInformationDescendingComparer();

sut.Compare(listing1, listing2).Should().Be(1);
sut.Compare(listing1, listing2).ShouldBe(1);
}

[TestMethod]
Expand All @@ -36,6 +36,6 @@ public void Edition_with_lower_year_compare_as_plus_zero()

var sut = new ListingInformationDescendingComparer();

sut.Compare(listing1, listing2).Should().Be(-1);
sut.Compare(listing1, listing2).ShouldBe(-1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ public void Status_is_NotAvailable_when_the_track_is_not_recorded()
{
var listing = new ListingInformation { Edition = 2000 };

sut.Determine(listing).Should().Be(ListingStatus.NotAvailable);
sut.Determine(listing).ShouldBe(ListingStatus.NotAvailable);
}

[TestMethod]
public void Status_is_NotListed_when_track_has_recorded_but_position_is_null()
{
var listing = new ListingInformation { Edition = 2002 };

sut.Determine(listing).Should().Be(ListingStatus.NotListed);
sut.Determine(listing).ShouldBe(ListingStatus.NotListed);
}

[TestMethod]
public void Status_is_New_when_track_has_position_is_filled_and_not_been_set()
{
var listing = new ListingInformation { Edition = 2002, Position = 12 };

sut.Determine(listing).Should().Be(ListingStatus.New);
sut.Determine(listing).ShouldBe(ListingStatus.New);
}

[TestMethod]
Expand All @@ -52,7 +52,7 @@ public void Status_is_Back_when_previous_status_is_NotListed_and_new_has_been_se

var listing = new ListingInformation { Edition = 2004, Position = 12 };

sut.Determine(listing).Should().Be(ListingStatus.Back);
sut.Determine(listing).ShouldBe(ListingStatus.Back);
}

[TestMethod]
Expand All @@ -68,7 +68,7 @@ public void Status_is_Unchanged_when_offset_0()
.ForEach(x => sut.Determine(x));

var current = new ListingInformation { Edition = 2003, Position = 2, Offset = 0 };
sut.Determine(current).Should().Be(ListingStatus.Unchanged);
sut.Determine(current).ShouldBe(ListingStatus.Unchanged);
}

[TestMethod]
Expand All @@ -84,7 +84,7 @@ public void Status_is_Increased_when_offset_negative()
.ForEach(x => sut.Determine(x));

var current = new ListingInformation { Edition = 2003, Position = 1, Offset = -1 };
sut.Determine(current).Should().Be(ListingStatus.Increased);
sut.Determine(current).ShouldBe(ListingStatus.Increased);
}

[TestMethod]
Expand All @@ -100,6 +100,6 @@ public void Status_is_Decreased_when_offset_positive()
.ForEach(x => sut.Determine(x));

var current = new ListingInformation { Edition = 2003, Position = 3, Offset = 1 };
sut.Determine(current).Should().Be(ListingStatus.Decreased);
sut.Determine(current).ShouldBe(ListingStatus.Decreased);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,37 @@ public TrackDetailsTests()
[TestMethod]
public void First_represents_the_first_time_the_track_was_listed()
{
sut.First.Should().Be(listing2000);
sut.First.ShouldBe(listing2000);
}

[TestMethod]
public void Highest_represents_the_first_highest_listing()
{
sut.Highest.Should().Be(listing2001);
sut.Highest.ShouldBe(listing2001);
}

[TestMethod]
public void Lowest_represents_the_latested_lowest_listing()
{
sut.Lowest.Should().Be(listing2003);
sut.Lowest.ShouldBe(listing2003);
}

[TestMethod]
public void Latest_represents_the_latest_listing()
{
sut.Latest.Should().Be(listing2004);
sut.Latest.ShouldBe(listing2004);
}

[TestMethod]
public void Appearences_shows_the_counts_of_listings()
{
sut.Appearances.Should().Be(5);
sut.Appearances.ShouldBe(5);
}

[TestMethod]
public void AppearancesPossible_shows_the_count_of_listings_possible_since_the_recorded_date()
{
sut.AppearancesPossible.Should().Be(6);
sut.AppearancesPossible.ShouldBe(6);
}
}
}
4 changes: 3 additions & 1 deletion tests/SQLite/Top2000.Features.SQLite.Unittests/Usings.cs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
global using FluentAssertions;
global using Shouldly;

[assembly: Parallelize]
6 changes: 3 additions & 3 deletions tests/Top2000.Features.Specs/Bindings/AllEditionsSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void ThenASortedSetIsReturnedStartedWithTheHighestYear()

foreach (var edition in editions)
{
edition.Year.Should().BeLessOrEqualTo(firstEdition.Year);
edition.Year.Should().BeLessThanOrEqualTo(firstEdition.Year);
}
}

Expand All @@ -59,8 +59,8 @@ public void ThenTheStart_AndEndDateTimeIsInLocalTime()
}
}

[Then(@"the UTC Statdate is as follow:")]
public void ThenTheUTCStatdateIsAsFollow(Table table)
[Then(@"the UTC Start date is as follow:")]
public void Then_TheUTCStartDateIsAsFollow(Table table)
{
var items = table.CreateSet<YearTimeCombo>();

Expand Down
Loading
Loading