Skip to content

Commit

Permalink
Closes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
ENikS committed Jun 20, 2019
1 parent 5787070 commit 1ca56db
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
28 changes: 28 additions & 0 deletions tests/GitHubIssuesFixture.cs
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));
}
}
}
8 changes: 3 additions & 5 deletions tests/ServiceLocatorFixture.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@


using CommonServiceLocator;
using Microsoft.Practices.Unity.ServiceLocation.Tests.Components;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections;
using System.Collections.Generic;
using CommonServiceLocator;
using Microsoft.Practices.Unity.ServiceLocation.Tests.Components;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Unity.ServiceLocation.Tests
{
Expand Down
7 changes: 2 additions & 5 deletions tests/UnityServiceLocatorAdapterFixture.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@


using System;
using CommonServiceLocator;
using Microsoft.Practices.Unity;
using CommonServiceLocator;
using Microsoft.Practices.Unity.ServiceLocation.Tests.Components;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace Unity.ServiceLocation.Tests
{
Expand Down

0 comments on commit 1ca56db

Please sign in to comment.