Skip to content

Commit

Permalink
Added coverlet.tests.projectsample.wpf5.tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lg2de authored and David Mueller IWS committed Apr 15, 2023
1 parent 313866a commit d877e25
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 1 deletion.
14 changes: 14 additions & 0 deletions coverlet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "coverlet.tests.projectsampl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "coverlet.tests.projectsample.aspnet5.tests", "test\coverlet.tests.projectsample.aspnet5.tests\coverlet.tests.projectsample.aspnet5.tests.csproj", "{8EC065A4-7700-45E6-8B90-0182E3649DEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "coverlet.tests.projectsample.wpf5", "test\coverlet.tests.projectsample.wpf5\coverlet.tests.projectsample.wpf5.csproj", "{988A5FF0-4326-4F5B-9F05-CB165543A555}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "coverlet.tests.projectsample.wpf5.tests", "test\coverlet.tests.projectsample.wpf5.tests\coverlet.tests.projectsample.wpf5.tests.csproj", "{44C7F807-F754-401D-B608-3697843A45E9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -146,6 +150,14 @@ Global
{8EC065A4-7700-45E6-8B90-0182E3649DEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EC065A4-7700-45E6-8B90-0182E3649DEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EC065A4-7700-45E6-8B90-0182E3649DEA}.Release|Any CPU.Build.0 = Release|Any CPU
{988A5FF0-4326-4F5B-9F05-CB165543A555}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{988A5FF0-4326-4F5B-9F05-CB165543A555}.Debug|Any CPU.Build.0 = Debug|Any CPU
{988A5FF0-4326-4F5B-9F05-CB165543A555}.Release|Any CPU.ActiveCfg = Release|Any CPU
{988A5FF0-4326-4F5B-9F05-CB165543A555}.Release|Any CPU.Build.0 = Release|Any CPU
{44C7F807-F754-401D-B608-3697843A45E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44C7F807-F754-401D-B608-3697843A45E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44C7F807-F754-401D-B608-3697843A45E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44C7F807-F754-401D-B608-3697843A45E9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -171,6 +183,8 @@ Global
{C9B7DC34-3E04-4F20-AED4-73791AF8020D} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{1C3CA3F8-DF8C-433F-8A56-69102D2BBDF6} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{8EC065A4-7700-45E6-8B90-0182E3649DEA} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{988A5FF0-4326-4F5B-9F05-CB165543A555} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
{44C7F807-F754-401D-B608-3697843A45E9} = {2FEBDE1B-83E3-445B-B9F8-5644B0E0E134}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9CA57C02-97B0-4C38-A027-EA61E8741F10}
Expand Down
1 change: 1 addition & 0 deletions src/coverlet.core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[assembly: InternalsVisibleTo("coverlet.collector.tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed0ed6af9693182615b8dcadc83c918b8d36312f86cefc69539d67d4189cd1b89420e7c3871802ffef7f5ca7816c68ad856c77bf7c230cc07824d96aa5d1237eebd30e246b9a14e22695fb26b40c800f74ea96619092cbd3a5d430d6c003fc7a82e8ccd1e315b935105d9232fe9e99e8d7ff54bba6f191959338d4a3169df9b3")]
[assembly: InternalsVisibleTo("coverlet.integration.tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010001d24efbe9cbc2dc49b7a3d2ae34ca37cfb69b4f450acd768a22ce5cd021c8a38ae7dc68b2809a1ac606ad531b578f192a5690b2986990cbda4dd84ec65a3a4c1c36f6d7bb18f08592b93091535eaee2f0c8e48763ed7f190db2008e1f9e0facd5c0df5aaab74febd3430e09a428a72e5e6b88357f92d78e47512d46ebdc3cbb")]
[assembly: InternalsVisibleTo("coverlet.tests.projectsample.aspnet5.tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100757cf9291d78a82e5bb58a827a3c46c2f959318327ad30d1b52e918321ffbd847fb21565b8576d2a3a24562a93e86c77a298b564a0f1b98f63d7a1441a3a8bcc206da3ed09d5dacc76e122a109a9d3ac608e21a054d667a2bae98510a1f0f653c0e6f58f42b4b3934f6012f5ec4a09b3dfd3e14d437ede1424bdb722aead64ad")]
[assembly: InternalsVisibleTo("coverlet.tests.projectsample.wpf5.tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100757cf9291d78a82e5bb58a827a3c46c2f959318327ad30d1b52e918321ffbd847fb21565b8576d2a3a24562a93e86c77a298b564a0f1b98f63d7a1441a3a8bcc206da3ed09d5dacc76e122a109a9d3ac608e21a054d667a2bae98510a1f0f653c0e6f58f42b4b3934f6012f5ec4a09b3dfd3e14d437ede1424bdb722aead64ad")]

// Needed to mock internal type https://github.com/Moq/moq4/wiki/Quickstart#advanced-features
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public void TestInstrument_NetCoreSharedFrameworkResolver()
true);

var assemblies = new List<string>();
Assert.True(resolver.TryResolveAssemblyPaths(compilationLibrary, assemblies));
Assert.True(resolver.TryResolveAssemblyPaths(compilationLibrary, assemblies),
"sample assembly shall be resolved");
Assert.NotEmpty(assemblies);
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/coverlet.tests.projectsample.wpf5.tests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) Toni Solarin-Sodara
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Reflection;

[assembly: AssemblyKeyFile("coverlet.tests.projectsample.wpf5.tests.snk")]
38 changes: 38 additions & 0 deletions test/coverlet.tests.projectsample.wpf5.tests/ResolverTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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.Linq;
using System.Reflection;
using Coverlet.Core.Abstractions;
using Coverlet.Core.Instrumentation;
using Microsoft.Extensions.DependencyModel;
using Moq;
using Xunit;

namespace coverlet.tests.projectsample.wpf5.tests
{
public class ResolverTests
{
[Fact]
public void TestInstrument_NetCoreSharedFrameworkResolver()
{
Assembly assembly = GetType().Assembly;
var mockLogger = new Mock<ILogger>();
var resolver = new NetCoreSharedFrameworkResolver(assembly.Location, mockLogger.Object);
var compilationLibrary = new CompilationLibrary(
"package",
"System.Drawing",
"5.0.17.0",
"sha512-B2WqEox8o+4KUOpL7rZPyh6qYjik8tHi2tN8Z9jZkHzED8ElYgZa/h6K+xliB435SqUcWT290Fr2aa8BtZjn8A==",
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);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="xunit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\coverlet.core\coverlet.core.csproj" />
<ProjectReference Include="..\coverlet.tests.projectsample.wpf5\coverlet.tests.projectsample.wpf5.csproj" />
</ItemGroup>

</Project>
Binary file not shown.
12 changes: 12 additions & 0 deletions test/coverlet.tests.projectsample.wpf5/TestClass.cs
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.wpf5
{
public class TestClass
{
public UserControl Control { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWpf>true</UseWpf>
<IsTestProject>false</IsTestProject>
</PropertyGroup>

</Project>

0 comments on commit d877e25

Please sign in to comment.