diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Aliases.approved.cs b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Aliases.verified.cs similarity index 99% rename from Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Aliases.approved.cs rename to Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Aliases.verified.cs index fa3adafe6b..dd4e99449a 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Aliases.approved.cs +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Aliases.verified.cs @@ -1,4 +1,4 @@ -[assembly: System.CLSCompliant(true)] +[assembly: System.CLSCompliant(true)] [assembly: System.Resources.NeutralResourcesLanguage("en-US")] [assembly: System.Runtime.InteropServices.ComVisible(false)] [assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName=".NET Framework 4.6")] diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.cs b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.verified.cs similarity index 99% rename from Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.cs rename to Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.verified.cs index c8750add6a..602878ba39 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.cs +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.verified.cs @@ -1,4 +1,4 @@ -[assembly: System.CLSCompliant(true)] +[assembly: System.CLSCompliant(true)] [assembly: System.Resources.NeutralResourcesLanguage("en-US")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Tests.System.Reactive, PublicKey=00240000048000009400000006020000002400005253413100040000010001008f5cff058631087031f8350f30a36fa078027e5df2316b564352dc9eb7af7ce856016d3c5e9d058036fe73bb5c83987bd3fc0793fbe25d633cc4f37c2bd5f1d717cd2a81661bec08f0971dc6078e17bde372b89005e7738a0ebd501b896ca3e8315270ff64df7809dd912c372df61785a5085b3553b7872e39b1b1cc0ff5a6bc")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Tests.System.Reactive.Uwp.DeviceRunner, PublicKey=00240000048000009400000006020000002400005253413100040000010001008f5cff058631087031f8350f30a36fa078027e5df2316b564352dc9eb7af7ce856016d3c5e9d058036fe73bb5c83987bd3fc0793fbe25d633cc4f37c2bd5f1d717cd2a81661bec08f0971dc6078e17bde372b89005e7738a0ebd501b896ca3e8315270ff64df7809dd912c372df61785a5085b3553b7872e39b1b1cc0ff5a6bc")] @@ -99,13 +99,10 @@ public interface ITaskObservable : System.IObservable public class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable { public ListObservable(System.IObservable source) { } - [System.Runtime.CompilerServices.IndexerName("Item")] - public int Item { get; } - [System.Runtime.CompilerServices.IndexerName("Item")] - public bool Item { get; } + public int Count { get; } + public bool IsReadOnly { get; } public T this[int index] { get; set; } - [System.Runtime.CompilerServices.IndexerName("Item")] - public T Item { get; } + public T Value { get; } public void Add(T item) { } public void Clear() { } public bool Contains(T item) { } diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.cs b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.verified.cs similarity index 99% rename from Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.cs rename to Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.verified.cs index 7c393f8996..b62f16132d 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.cs +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.verified.cs @@ -1,4 +1,4 @@ -[assembly: System.CLSCompliant(true)] +[assembly: System.CLSCompliant(true)] [assembly: System.Runtime.InteropServices.ComVisible(false)] [assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName=".NET Framework 4.6")] namespace Microsoft.Reactive.Testing diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.cs b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.cs index 218f8988db..4c4064fd2d 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.cs +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.cs @@ -2,49 +2,50 @@ // The .NET Foundation licenses this file to you under the MIT License. // See the LICENSE file in the project root for more information. -using ApprovalTests; -using ApprovalTests.Reporters; using PublicApiGenerator; using System; using System.Linq; using System.Reflection; +using System.Threading.Tasks; +using Verify; +using VerifyXunit; using Xunit; using Xunit.Abstractions; namespace ReactiveTests.Tests.Api { -#if DEBUG - [UseReporter(typeof(DiffReporter))] -#else - [UseReporter(typeof(DiffPlexReporter))] -#endif - [IgnoreLineEndings(true)] - public class ApiApprovalTests + public class ApiApprovalTests : + VerifyBase { - public ApiApprovalTests(ITestOutputHelper output) + VerifySettings verifySettings; + + public ApiApprovalTests(ITestOutputHelper output) : + base(output) { - DiffPlexReporter.INSTANCE.Output = output; + verifySettings = new VerifySettings(); + verifySettings.UseExtension("cs"); + verifySettings.OnVerifyMismatch(DiffPlexReporter.Report); } [Fact] - public void Core() + public Task Core() { var publicApi = GeneratePublicApi(typeof(System.Reactive.Unit).Assembly); - Approvals.Verify(new ApprovalTextWriter(publicApi, "cs")); + return Verify(publicApi, verifySettings); } [Fact] - public void Aliases() + public Task Aliases() { var publicApi = GeneratePublicApi(typeof(System.Reactive.Observable.Aliases.QueryLanguage).Assembly); - Approvals.Verify(new ApprovalTextWriter(publicApi, "cs")); + return Verify(publicApi, verifySettings); } [Fact] - public void Testing() + public Task Testing() { var publicApi = GeneratePublicApi(typeof(Microsoft.Reactive.Testing.TestScheduler).Assembly); - Approvals.Verify(new ApprovalTextWriter(publicApi, "cs")); + return Verify(publicApi, verifySettings); } private string GeneratePublicApi(Assembly assembly) diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/DiffPlexReporter.cs b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/DiffPlexReporter.cs index 56db8fb269..a900bc5972 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/DiffPlexReporter.cs +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/DiffPlexReporter.cs @@ -2,28 +2,24 @@ // The .NET Foundation licenses this file to you under the MIT License. // See the LICENSE file in the project root for more information. -using ApprovalTests.Core; +using System; +using System.IO; +using System.Threading.Tasks; using DiffPlex; using DiffPlex.DiffBuilder; using DiffPlex.DiffBuilder.Model; -using System.IO; -using Xunit.Abstractions; namespace ReactiveTests.Tests { - public class DiffPlexReporter : IApprovalFailureReporter + public static class DiffPlexReporter { - public static DiffPlexReporter INSTANCE = new DiffPlexReporter(); - - public ITestOutputHelper Output { get; set; } - - public void Report(string approved, string received) + public static async Task Report(string receivedFile, string verifiedFile) { - var approvedText = File.Exists(approved) ? File.ReadAllText(approved) : string.Empty; - var receivedText = File.ReadAllText(received); - + #if(!DEBUG) + var receivedText = File.ReadAllText(receivedFile); + var verifiedText = File.ReadAllText(verifiedFile); var diffBuilder = new InlineDiffBuilder(new Differ()); - var diff = diffBuilder.BuildDiffModel(approvedText, receivedText); + var diff = diffBuilder.BuildDiffModel(verifiedText, receivedText); foreach (var line in diff.Lines) { @@ -40,8 +36,9 @@ public void Report(string approved, string received) break; } - Output.WriteLine("{0}{1}", prefix, line.Text); + Console.WriteLine("{0}{1}", prefix, line.Text); } + #endif } } } diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj index 3f76175d6e..8f523b45d5 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj +++ b/Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj @@ -1,17 +1,15 @@  - net461 + net48 $(NoWarn);CS0618 - full - true - false + false - - - + + + @@ -29,9 +27,9 @@ + - diff --git a/Rx.NET/Source/tests/Tests.System.Reactive/Tests/LicenseHeaderTest.cs b/Rx.NET/Source/tests/Tests.System.Reactive/Tests/LicenseHeaderTest.cs index ff5b9a3d3d..d91cc6b9a9 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive/Tests/LicenseHeaderTest.cs +++ b/Rx.NET/Source/tests/Tests.System.Reactive/Tests/LicenseHeaderTest.cs @@ -53,7 +53,7 @@ private int ScanPath(string path, StringBuilder error) || file.Contains("AssemblyInfo.cs") || file.Contains(".Designer.cs") || file.Contains(".Generated.cs") - || file.Contains(".approved.cs") + || file.Contains(".verified.cs") || file.Contains("Uwp.DeviceRunner") ) { diff --git a/azure-pipelines.rx.yml b/azure-pipelines.rx.yml index be03222160..c4483f16c4 100644 --- a/azure-pipelines.rx.yml +++ b/azure-pipelines.rx.yml @@ -83,7 +83,6 @@ stages: projects: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj arguments: -c $(BuildConfiguration) --no-build --no-restore displayName: Run Api Approvals Tests - enabled: false - script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports -reporttypes:"Cobertura" displayName: Create reports