Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
housekeeping: .NET Core App 2.0 tests & Tests Cleanups (#1926)
* housekeeping: .NET Core App 2.0 tests & Tests Cleanups * Now compiling for .net core app 2.0, .net 4.6.1, uwp (not yet being run --next pass) * Turned on most of the analyzers for the test project. Cleaned up approriately * Updated the cake build script to do coverage tests on platforms where they are supported * Updated open cover version. * Approval tests now include the framework version.
- Loading branch information
1 parent
17d5bfa
commit 5989379
Showing
174 changed files
with
7,195 additions
and
5,224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.ReactiveUIFody.netcoreapp2.0.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("ReactiveUI.AndroidSupport")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("ReactiveUI.Tests")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("ReactiveUI.Winforms")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("ReactiveUI.Wpf")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("ReactiveUI.XamForms")] | ||
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v2.0", FrameworkDisplayName="")] | ||
namespace ReactiveUI.Fody.Helpers | ||
{ | ||
[System.AttributeUsageAttribute(System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.All)] | ||
public class ObservableAsPropertyAttribute : System.Attribute | ||
{ | ||
public ObservableAsPropertyAttribute() { } | ||
} | ||
public class static ObservableAsPropertyExtensions | ||
{ | ||
public static ReactiveUI.ObservableAsPropertyHelper<TRet> ToPropertyEx<TObj, TRet>(this System.IObservable<TRet> @this, TObj source, System.Linq.Expressions.Expression<System.Func<TObj, TRet>> property, TRet initialValue = null, bool deferSubscription = False, System.Reactive.Concurrency.IScheduler scheduler = null) | ||
where TObj : ReactiveUI.ReactiveObject { } | ||
} | ||
[System.AttributeUsageAttribute(System.AttributeTargets.Property | System.AttributeTargets.All)] | ||
public class ReactiveAttribute : System.Attribute | ||
{ | ||
public ReactiveAttribute() { } | ||
} | ||
[System.AttributeUsageAttribute(System.AttributeTargets.Property | System.AttributeTargets.All)] | ||
public class ReactiveDependencyAttribute : System.Attribute | ||
{ | ||
public ReactiveDependencyAttribute(string targetName) { } | ||
public string Target { get; } | ||
public string TargetProperty { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using PublicApiGenerator; | ||
using Shouldly; | ||
using Splat; | ||
using Xunit; | ||
|
||
namespace ReactiveUI.Fody.Tests | ||
{ | ||
[ExcludeFromCodeCoverage] | ||
public abstract class ApiApprovalBase | ||
{ | ||
private static readonly Regex _removeCoverletSectionRegex = new Regex(@"^namespace Coverlet\.Core\.Instrumentation\.Tracker.*?^}", RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.Compiled); | ||
|
||
protected static void CheckApproval(Assembly assembly, [CallerMemberName]string memberName = null, [CallerFilePath]string filePath = null) | ||
{ | ||
var targetFrameworkName = Assembly.GetExecutingAssembly().GetTargetFrameworkName(); | ||
|
||
var sourceDirectory = Path.GetDirectoryName(filePath); | ||
|
||
var approvedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.approved.txt"); | ||
var receivedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.received.txt"); | ||
|
||
string approvedPublicApi = string.Empty; | ||
|
||
if (File.Exists(approvedFileName)) | ||
{ | ||
approvedPublicApi = File.ReadAllText(approvedFileName); | ||
} | ||
|
||
var receivedPublicApi = Filter(ApiGenerator.GeneratePublicApi(assembly)); | ||
|
||
if (!string.Equals(receivedPublicApi, approvedPublicApi, StringComparison.InvariantCulture)) | ||
{ | ||
File.WriteAllText(receivedFileName, receivedPublicApi); | ||
ShouldlyConfiguration.DiffTools.GetDiffTool().Open(receivedFileName, approvedFileName, true); | ||
} | ||
|
||
Assert.Equal(approvedPublicApi, receivedPublicApi); | ||
} | ||
|
||
private static string Filter(string text) | ||
{ | ||
text = _removeCoverletSectionRegex.Replace(text, string.Empty); | ||
return string.Join(Environment.NewLine, text.Split( | ||
new[] | ||
{ | ||
Environment.NewLine | ||
}, StringSplitOptions.RemoveEmptyEntries) | ||
.Where(l => | ||
!l.StartsWith("[assembly: AssemblyVersion(", StringComparison.InvariantCulture) && | ||
!l.StartsWith("[assembly: AssemblyFileVersion(", StringComparison.InvariantCulture) && | ||
!l.StartsWith("[assembly: AssemblyInformationalVersion(", StringComparison.InvariantCulture) && | ||
!string.IsNullOrWhiteSpace(l))); | ||
} | ||
} | ||
} |
Oops, something went wrong.