forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test against ctor with attribute order dotnet#42339
Using [ActivatorUtilitiesconstructor] attribute on a constructor should force `ActivatorUtilities.CreateInstance` to use that constructor regardless of the constructor definition order. This test shows that it is not the case in current implementaion.
- Loading branch information
1 parent
4d26c31
commit 90e0dfd
Showing
2 changed files
with
38 additions
and
0 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
21 changes: 21 additions & 0 deletions
21
...ndencyInjection.Specification.Tests/src/Fakes/ClassWithAmbiguousCtorsAndAttributeFirst.cs
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,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes | ||
{ | ||
public class ClassWithAmbiguousCtorsAndAttributeFirst | ||
{ | ||
[ActivatorUtilitiesConstructor] | ||
public ClassWithAmbiguousCtorsAndAttributeFirst(int dependency1, IFakeService dependency2, string dependency3) | ||
{ | ||
CtorUsed = "int, IFakeService, string"; | ||
} | ||
|
||
public ClassWithAmbiguousCtorsAndAttributeFirst(int dependency1, string dependency3) | ||
{ | ||
CtorUsed = "int, string"; | ||
} | ||
|
||
public string CtorUsed { get; set; } | ||
} | ||
} |