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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RepositoryUrl>https://github.com/Testably/Testably.Abstractions.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)/strongname.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
Expand Down
21 changes: 11 additions & 10 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
<ItemGroup>
<PackageVersion Include="DotNet.Glob" Version="3.1.3"/>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4"/>
<PackageVersion Include="System.Linq.Async" Version="7.0.0"/>
<PackageVersion Include="System.IO.Compression" Version="4.3.0"/>
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0"/>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageVersion Include="System.Threading.Channels" Version="[6.0.0]"/>
<PackageVersion Include="System.Linq.Async" Version="[6.0.3]"/>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageVersion Include="System.Threading.Channels" Version="[8.0.0]"/>
<PackageVersion Include="System.Linq.Async" Version="7.0.0"/>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'net8.0' And '$(TargetFramework)' != 'net6.0' ">
<PackageVersion Include="System.Threading.Channels" Version="10.0.3"/>
<PackageVersion Include="System.Linq.Async" Version="7.0.0"/>
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Nullable" Version="1.3.1"/>
Expand All @@ -31,20 +33,19 @@
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0"/>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.3"/>
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.1.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.5.1" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="AutoFixture.AutoNSubstitute" Version="5.0.0-preview0012"/>
<PackageVersion Include="AutoFixture.Xunit3" Version="5.0.0-preview0012"/>
<PackageVersion Include="System.Net.Http" Version="4.3.4"/>
<PackageVersion Include="aweXpect" Version="2.30.0"/>
<PackageVersion Include="aweXpect.Testably" Version="0.13.0"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1"/>
<PackageVersion Include="xunit.v3" Version="3.2.2"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5"/>
<PackageVersion Include="coverlet.collector" Version="6.0.4"/>
<PackageVersion Include="aweXpect.Mockolate" Version="1.1.1"/>
<PackageVersion Include="Mockolate" Version="1.5.0"/>
<PackageVersion Include="TUnit.Engine" Version="1.17.54"/>
<PackageVersion Include="Polyfill" Version="9.1.0"/>
<PackageVersion Include="PublicApiGenerator" Version="11.5.4"/>
<PackageVersion Include="NUnit" Version="4.4.0"/>
<PackageVersion Include="NUnit.Analyzers" Version="4.11.2"/>
<PackageVersion Include="NUnit3TestAdapter" Version="6.1.0"/>
<PackageVersion Include="AutoFixture" Version="4.18.1" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Testably.Abstractions.Interface" Version="10.1.0"/>
Expand Down
17 changes: 8 additions & 9 deletions Pipeline/Build.ApiChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ partial class Build
};

DotNetTest(s => s
.SetConfiguration(Configuration)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.SetResultsDirectory(TestResultsDirectory)
.CombineWith(
projects,
(settings, project) => settings
.SetProjectFile(project)
.AddLoggers($"trx;LogFileName={project.Name}.trx")),
completeOnFailure: true);
.SetConfiguration(Configuration)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.SetResultsDirectory(TestResultsDirectory)
.CombineWith(
projects,
(settings, project) => settings
.AddProcessAdditionalArguments(
$"--project \"{project.Path}\" -- --report-trx")));
});
}
2 changes: 1 addition & 1 deletion Pipeline/Build.CodeCoverage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ partial class Build
.SetProcessToolPath(NuGetToolPathResolver.GetPackageExecutable("ReportGenerator", "ReportGenerator.dll",
framework: "net8.0"))
.SetTargetDirectory(TestResultsDirectory / "reports")
.AddReports(TestResultsDirectory / "**/coverage.cobertura.xml")
.AddReports(TestResultsDirectory / "**/*.cobertura.xml")
.AddReportTypes(ReportTypes.OpenCover)
.AddFileFilters("-*.g.cs")
.SetAssemblyFilters("+Testably*"));
Expand Down
8 changes: 4 additions & 4 deletions Pipeline/Build.MutationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ await gitHubClient.Issue.Comment.Update("Testably", "Testably.Abstractions",
{{string.Join(",\n\t\t\t", project.Value.Select(PathForJson))}}
],
"project": {{PathForJson(project.Key)}},
"target-framework": "net8.0",
"target-framework": "net10.0",
"since": {
"target": "main",
"enabled": {{(GitVersion?.BranchName != "main").ToString().ToLowerInvariant()}},
Expand Down Expand Up @@ -259,7 +259,7 @@ await gitHubClient.Issue.Comment.Update("Testably", "Testably.Abstractions",
{{string.Join(",\n\t\t\t", project.Value.Select(PathForJson))}}
],
"project": {{PathForJson(project.Key)}},
"target-framework": "net8.0",
"target-framework": "net10.0",
"since": {
"target": "main",
"enabled": {{(GitVersion?.BranchName != "main").ToString().ToLowerInvariant()}},
Expand All @@ -280,8 +280,8 @@ await gitHubClient.Issue.Comment.Update("Testably", "Testably.Abstractions",
Log.Debug($"Created '{configFile}':{Environment.NewLine}{configText}");

string arguments = IsServerBuild
? $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"Dashboard\" -r \"cleartext\""
: $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"cleartext\"";
? $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"Dashboard\" -r \"cleartext\" --test-runner mtp"
: $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"cleartext\" --test-runner mtp";

string executable = EnvironmentInfo.IsWin ? "dotnet-stryker.exe" : "dotnet-stryker";
IProcess process = ProcessTasks.StartProcess(
Expand Down
6 changes: 2 additions & 4 deletions Pipeline/Build.UnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ partial class Build
DotNetTest(s => s
.SetConfiguration(Configuration)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.SetDataCollector("XPlat Code Coverage")
.SetResultsDirectory(TestResultsDirectory)
.CombineWith(
UnitTestProjects,
(settings, project) => settings
.SetProjectFile(project)
.CombineWith(
project.GetTargetFrameworks()?.Except(excludedFrameworks),
(frameworkSettings, framework) => frameworkSettings
.SetFramework(framework)
.AddLoggers(
$"trx;LogFileName={project.Name}_{framework}.trx")
.AddProcessAdditionalArguments(
$"--project \"{project.Path}\" -- --report-trx --coverage --coverage-output-format cobertura ")
)
), completeOnFailure: true
);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private string GetFileContent()

Then you test your class with the mocked types in `Testably.Abstractions.Testing`:
```csharp
[Fact]
[Test]
public void StoreData_ShouldWriteValidFile()
{
IFileSystem fileSystem = new MockFileSystem();
Expand Down
5 changes: 4 additions & 1 deletion Testably.Abstractions.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EUnitTestFramework_002EMigrations_002EEnableDisabledProvidersMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/UnitTesting/DisabledProviders/=Testing_0020Platform/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/UnitTesting/TestingPlatformTestProvider/IgnoreProjectsSupportedByOtherProviders/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=MacOS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=_002E_002E/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/GrammarAndSpelling/GrammarChecking/RulesStates/=LanguageTool_002EEN_002EEN_005FA_005FVS_005FAN/@EntryIndexedValue">DisabledByUser</s:String>
Expand All @@ -475,4 +478,4 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Skippable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Subdirectory/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Testably/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
</wpf:ResourceDictionary>
7 changes: 0 additions & 7 deletions Testably.Abstractions.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
</Folder>
<Folder Name="/Tests/Helpers/">
<Project Path="Tests/Helpers/Testably.Abstractions.TestHelpers/Testably.Abstractions.TestHelpers.csproj" />
<Project Path="Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Testably.Abstractions.Tests.SourceGenerator.csproj" />
</Folder>
<Folder Name="/Tests/Settings/">
<Project Path="Tests/Settings/Testably.Abstractions.TestSettings/Testably.Abstractions.TestSettings.csproj" />
</Folder>
<Folder Name="/_/">
<File Path=".codacy.yml" />
Expand Down Expand Up @@ -69,9 +65,6 @@
<Folder Name="/_/Tests/">
<File Path="Tests/Directory.Build.props" />
</Folder>
<Folder Name="/_/Tests/Api/">
<File Path="Tests/Api/Directory.Build.props" />
</Folder>
<Project Path="Source/Testably.Abstractions.AccessControl/Testably.Abstractions.AccessControl.csproj" />
<Project Path="Source/Testably.Abstractions.Compression/Testably.Abstractions.Compression.csproj" />
<Project Path="Source/Testably.Abstractions.Testing/Testably.Abstractions.Testing.csproj" />
Expand Down
38 changes: 0 additions & 38 deletions Tests/Api/Directory.Build.props

This file was deleted.

10 changes: 6 additions & 4 deletions Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using NUnit.Framework;
using aweXpect;
using TUnit;
using System;
using System.Threading.Tasks;

namespace Testably.Abstractions.Api.Tests;

Expand All @@ -8,9 +10,9 @@ public sealed class ApiAcceptance
/// <summary>
/// Execute this test to update the expected public API to the current API surface.
/// </summary>
[TestCase]
[Test]
[Explicit]
public void AcceptApiChanges()
public async Task AcceptApiChanges()
{
string[] assemblyNames =
[
Expand All @@ -30,6 +32,6 @@ public void AcceptApiChanges()
}
}

Assert.That(assemblyNames, Is.Not.Empty);
await Expect.That(assemblyNames).IsNotEmpty();
}
}
54 changes: 22 additions & 32 deletions Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NUnit.Framework;
using System.Collections;
using aweXpect;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Testably.Abstractions.Api.Tests;

Expand All @@ -10,65 +11,54 @@ namespace Testably.Abstractions.Api.Tests;
/// </summary>
public sealed class ApiApprovalTests
{
[TestCaseSource(typeof(TargetFrameworksTheoryData))]
public void VerifyPublicApiForTestablyAbstractions(string framework)
public static IEnumerable<string> TargetFrameworks()
=> Helper.GetTargetFrameworks();

[Test]
[MethodDataSource(nameof(TargetFrameworks))]
public async Task VerifyPublicApiForTestablyAbstractions(string framework)
{
const string assemblyName = "Testably.Abstractions";

string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);

Assert.That(publicApi, Is.EqualTo(expectedApi));
await Expect.That(publicApi).IsEqualTo(expectedApi);
}

[TestCaseSource(typeof(TargetFrameworksTheoryData))]
public void VerifyPublicApiForTestablyAbstractionsAccessControl(string framework)
[Test]
[MethodDataSource(nameof(TargetFrameworks))]
public async Task VerifyPublicApiForTestablyAbstractionsAccessControl(string framework)
{
const string assemblyName = "Testably.Abstractions.AccessControl";

string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);

Assert.That(publicApi, Is.EqualTo(expectedApi));
await Expect.That(publicApi).IsEqualTo(expectedApi);
}

[TestCaseSource(typeof(TargetFrameworksTheoryData))]
public void VerifyPublicApiForTestablyAbstractionsCompression(string framework)
[Test]
[MethodDataSource(nameof(TargetFrameworks))]
public async Task VerifyPublicApiForTestablyAbstractionsCompression(string framework)
{
const string assemblyName = "Testably.Abstractions.Compression";

string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);

Assert.That(publicApi, Is.EqualTo(expectedApi));
await Expect.That(publicApi).IsEqualTo(expectedApi);
}

[TestCaseSource(typeof(TargetFrameworksTheoryData))]
public void VerifyPublicApiForTestablyAbstractionsTesting(string framework)
[Test]
[MethodDataSource(nameof(TargetFrameworks))]
public async Task VerifyPublicApiForTestablyAbstractionsTesting(string framework)
{
const string assemblyName = "Testably.Abstractions.Testing";

string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);

Assert.That(publicApi, Is.EqualTo(expectedApi));
}

private sealed class TargetFrameworksTheoryData : IEnumerable
{
#region IEnumerable Members

public IEnumerator GetEnumerator()
{
foreach (string targetFramework in Helper.GetTargetFrameworks())
{
yield return new object[]
{
targetFramework
};
}
}

#endregion
await Expect.That(publicApi).IsEqualTo(expectedApi);
}
}
2 changes: 1 addition & 1 deletion Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Xml.Linq;
using System.Xml.XPath;
using Assembly = System.Reflection.Assembly;

namespace Testably.Abstractions.Api.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PublicApiGenerator"/>
<PackageReference Remove="System.Net.Http" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading
Loading