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
9 changes: 5 additions & 4 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Platform>AnyCPU</Platform>
<DebugType>embedded</DebugType>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<SourceLinkEnabled></SourceLinkEnabled>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,10 +30,10 @@
</ItemGroup>

<ItemGroup Condition="$(IsTestProject)">
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.console" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Xunit.StaFact" Version="0.2.9" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.console" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="Xunit.StaFact" Version="0.2.17" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true' and '$(SourceLinkEnabled)' != 'false'">
Expand Down
6 changes: 2 additions & 4 deletions src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,22 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using ApprovalTests;
using ApprovalTests.Reporters;
using PublicApiGenerator;
using ReactiveUI.Fody.Helpers;
using Shouldly;
using Xunit;

namespace ReactiveUI.Fody.Tests.API
{
[ExcludeFromCodeCoverage]
[UseReporter(typeof(DiffReporter))]
public class ApiApprovalTests
{

[Fact]
public void ReactiveUI_Fody()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(ReactiveAttribute).Assembly));
Approvals.Verify(publicApi);
publicApi.ShouldMatchApproved();
}

private static string Filter(string text)
Expand Down
11 changes: 8 additions & 3 deletions src/ReactiveUI.Fody.Tests/ReactiveUI.Fody.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<PropertyGroup>
<TargetFrameworks>net461</TargetFrameworks>
<IsPackable>false</IsPackable>
<DebugType>full</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="PublicApiGenerator" Version="6.4.0" />
<PackageReference Include="PublicApiGenerator" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="ApprovalTests" Version=" 3.0.15" />
<PackageReference Include="Shouldly" Version=" 3.0.0" />
<PackageReference Include="System.Reactive" Version="4.0.0" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.0.0" />
</ItemGroup>
Expand All @@ -36,11 +37,15 @@
<ItemGroup>
<WeaverFiles Include="..\ReactiveUI.Fody\bin\$(Configuration)\$(TargetFramework)\ReactiveUI.Fody.*" />
</ItemGroup>

<ItemGroup>
<None Include="API\**\*.txt" CopyToOutputDirectory="PreserveNewest" LinkBase="/" />
</ItemGroup>

<Target Name="CopyWeavers" BeforeTargets="BeforeBuild">
<!-- Fody expects to find weavers in referenced NuGet packages or the Tools directory at the solution level.
Since this is for testing purposes before a NuGet package is created, we'll just use the Tools directory
until the projects are setup as suggested here: https://github.com/Fody/BasicFodyAddin -->
<Copy SourceFiles="@(WeaverFiles)" DestinationFolder="..\Tools" />
<Copy SourceFiles="@(WeaverFiles)" DestinationFolder="..\Tools" />
</Target>
</Project>
12 changes: 5 additions & 7 deletions src/ReactiveUI.Tests/API/ApiApprovalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,42 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using ApprovalTests;
using ApprovalTests.Reporters;
using PublicApiGenerator;
using Shouldly;
using Xunit;

namespace ReactiveUI.Tests.API
{
[ExcludeFromCodeCoverage]
[UseReporter(typeof(DiffReporter))]
public class ApiApprovalTests
{
[Fact]
public void Blend()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(Blend.ObservableTrigger).Assembly));
Approvals.Verify(publicApi);
publicApi.ShouldMatchApproved();
}

[Fact]
public void Testing()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(Testing.TestUtils).Assembly));
Approvals.Verify(publicApi);
publicApi.ShouldMatchApproved();
}

[Fact]
public void ReactiveUI()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(RxApp).Assembly));
Approvals.Verify(publicApi);
publicApi.ShouldMatchApproved();
}

[Fact]
public void Winforms()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(ReactiveUI.Winforms.WinformsCreatesObservableForProperty).Assembly));

Approvals.Verify(publicApi);
publicApi.ShouldMatchApproved();
}

private static string Filter(string text)
Expand Down
Loading