-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added coverlet.tests.projectsample.wpf6 with integration test
- Loading branch information
Showing
8 changed files
with
88 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Toni Solarin-Sodara | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using Coverlet.Core.Abstractions; | ||
using Coverlet.Core.Instrumentation; | ||
using Coverlet.Tests.Xunit.Extensions; | ||
using Microsoft.Extensions.DependencyModel; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Coverlet.Integration.Tests | ||
{ | ||
public class WpfResolverTests : BaseTest | ||
{ | ||
[ConditionalFact] | ||
[SkipOnOS(OS.Linux, "WPF only runs on Windows")] | ||
[SkipOnOS(OS.MacOS, "WPF only runs on Windows")] | ||
public void TestInstrument_NetCoreSharedFrameworkResolver() | ||
{ | ||
string wpfProjectPath = "../../../../coverlet.tests.projectsample.wpf6"; | ||
Assert.True(DotnetCli($"build \"{wpfProjectPath}\"", out string output, out string error)); | ||
string assemblyLocation = Directory.GetFiles($"{wpfProjectPath}/bin", "coverlet.tests.projectsample.wpf6.dll", SearchOption.AllDirectories).First(); | ||
|
||
var mockLogger = new Mock<ILogger>(); | ||
var resolver = new NetCoreSharedFrameworkResolver(assemblyLocation, mockLogger.Object); | ||
var compilationLibrary = new CompilationLibrary( | ||
"package", | ||
"System.Drawing", | ||
"0.0.0.0", | ||
"sha512-not-relevant", | ||
Enumerable.Empty<string>(), | ||
Enumerable.Empty<Dependency>(), | ||
true); | ||
|
||
var assemblies = new List<string>(); | ||
Assert.True(resolver.TryResolveAssemblyPaths(compilationLibrary, assemblies), | ||
"sample assembly shall be resolved"); | ||
Assert.NotEmpty(assemblies); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) Toni Solarin-Sodara | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace coverlet.tests.projectsample.wpf6; | ||
|
||
public static class Program | ||
{ | ||
public static void Main() { } | ||
} |
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,12 @@ | ||
// Copyright (c) Toni Solarin-Sodara | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Windows.Controls; | ||
|
||
namespace coverlet.tests.projectsample.wpf6 | ||
{ | ||
public class TestClass | ||
{ | ||
public UserControl? Control { get; set; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/coverlet.tests.projectsample.wpf6/coverlet.tests.projectsample.wpf6.csproj
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,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWpf>true</UseWpf> | ||
<IsTestProject>false</IsTestProject> | ||
<EnableWindowsTargeting>true</EnableWindowsTargeting> | ||
</PropertyGroup> | ||
|
||
</Project> |