-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from brandhuf/Issue46Fix
Issue #46 Fix
- Loading branch information
Showing
2 changed files
with
52 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2019 Florian Gather <[email protected]> | ||
// Copyright 2019 Fritz Brandhuber <[email protected]> | ||
// Copyright 2020 Pavel Fischer <[email protected]> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
using System.Linq; | ||
using ArchUnitNET.Domain; | ||
using ArchUnitNET.Domain.Extensions; | ||
using ArchUnitNET.Loader; | ||
using Xunit; | ||
|
||
namespace ArchUnitNETTests.GithubIssuesTests | ||
{ | ||
public class GithubIssue46Test | ||
{ | ||
private static readonly Architecture Architecture = | ||
new ArchLoader().LoadAssembly(typeof(GithubIssue46Test).Assembly).Build(); | ||
|
||
private readonly MethodMember _oneGenericArgumentMethod; | ||
private readonly MethodMember _twoGenericArgumentsMethod; | ||
|
||
public GithubIssue46Test() | ||
{ | ||
var intf = Architecture.GetInterfaceOfType(typeof(ITestGenericMethods)); | ||
_oneGenericArgumentMethod = intf.GetMethodMembers() | ||
.First(member => member.GenericParameters.Count == 1); | ||
_twoGenericArgumentsMethod = intf.GetMethodMembers() | ||
.First(member => member.GenericParameters.Count == 2); | ||
} | ||
|
||
|
||
[Fact] | ||
public void AssignDifferentGenericParametersToMethodsWithSameName() | ||
{ | ||
Assert.NotNull(_oneGenericArgumentMethod); | ||
Assert.NotNull(_twoGenericArgumentsMethod); | ||
|
||
Assert.Empty( | ||
_oneGenericArgumentMethod.GenericParameters.Intersect(_twoGenericArgumentsMethod.GenericParameters)); | ||
} | ||
} | ||
|
||
internal interface ITestGenericMethods | ||
{ | ||
void Method<T, K>(); | ||
void Method<T>(); | ||
} | ||
} |