forked from reactiveui/ReactiveUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApiApprovalTests.cs
More file actions
61 lines (54 loc) · 1.92 KB
/
ApiApprovalTests.cs
File metadata and controls
61 lines (54 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MS-PL license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using ApprovalTests;
using ApprovalTests.Reporters;
using PublicApiGenerator;
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);
}
[Fact]
public void Testing()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(Testing.TestUtils).Assembly));
Approvals.Verify(publicApi);
}
[Fact]
public void ReactiveUI()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(RxApp).Assembly));
Approvals.Verify(publicApi);
}
[Fact]
public void Winforms()
{
var publicApi = Filter(ApiGenerator.GeneratePublicApi(typeof(ReactiveUI.Winforms.WinformsCreatesObservableForProperty).Assembly));
Approvals.Verify(publicApi);
}
private static string Filter(string text)
{
return string.Join(Environment.NewLine, text.Split(new[]
{
Environment.NewLine
}, StringSplitOptions.RemoveEmptyEntries)
.Where(l => !l.StartsWith("[assembly: AssemblyVersion("))
.Where(l => !l.StartsWith("[assembly: AssemblyFileVersion("))
.Where(l => !l.StartsWith("[assembly: AssemblyInformationalVersion("))
.Where(l => !string.IsNullOrWhiteSpace(l))
);
}
}
}