-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
33 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using CommonServiceLocator; | ||
using Microsoft.Practices.Unity.ServiceLocation.Tests.Components; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Unity; | ||
using Unity.Lifetime; | ||
using Unity.ServiceLocation; | ||
|
||
namespace ServiceLocation.Tests | ||
{ | ||
[TestClass] | ||
public class GitHubIssuesFixture | ||
{ | ||
[TestMethod] | ||
public void Issue_5() | ||
{ | ||
var container = new UnityContainer(); | ||
container.RegisterType<SimpleLogger>(new ContainerControlledLifetimeManager()); | ||
|
||
var locator = new UnityServiceLocator(container); | ||
ServiceLocator.SetLocatorProvider(() => locator); | ||
|
||
var logger = ServiceLocator.Current.GetInstance<SimpleLogger>(); | ||
|
||
Assert.IsNotNull(logger); | ||
Assert.IsInstanceOfType(logger, typeof(SimpleLogger)); | ||
} | ||
} | ||
} |
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