-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
36 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
43 changes: 43 additions & 0 deletions
43
...sts/GHIssue506_WithConcreteTypeDynamicRegistrations_hides_failed_dependency_resolution.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,43 @@ | ||
using System; | ||
using NUnit.Framework; | ||
|
||
namespace DryIoc.IssuesTests | ||
{ | ||
[TestFixture] | ||
public class GHIssue506_WithConcreteTypeDynamicRegistrations_hides_failed_dependency_resolution : ITest | ||
{ | ||
public int Run() | ||
{ | ||
Test(); | ||
return 1; | ||
} | ||
|
||
[Test] | ||
public void Test() | ||
{ | ||
var containerWithNiceException = new Container(); | ||
containerWithNiceException.Register<Service>(); | ||
|
||
const string expected = @"as parameter ""dependency"""; | ||
|
||
var ex = Assert.Throws<ContainerException>(() => containerWithNiceException.Resolve<Service>()); | ||
StringAssert.Contains(expected, ex.Message); | ||
|
||
var containerWithAutoConcreteTypes = new Container(rules => rules.WithConcreteTypeDynamicRegistrations(IfUnresolved.Throw, reuse: Reuse.Transient)); | ||
|
||
var ex2 = Assert.Throws<ContainerException>(() => containerWithAutoConcreteTypes.Resolve<Service>()); | ||
StringAssert.Contains(expected, ex2.Message); | ||
} | ||
|
||
internal class Service | ||
{ | ||
public Service(IDependency dependency) | ||
{ | ||
} | ||
} | ||
|
||
internal interface IDependency | ||
{ | ||
} | ||
} | ||
} |
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