using NUnit.Framework; using System; using System.Collections.Generic; using TINK.Services; namespace TestTINKLib.Fixtures.ObjectTests.Services { [TestFixture] public class TestServicesContainerMutable { [Test] public void TestCtor() { var container = new ServicesContainerMutable(new List { new A(), new B() }, typeof(B).FullName); Assert.That(container.Active.GetType().FullName, Is.EqualTo("TestTINKLib.Fixtures.ObjectTests.Services.TestServicesContainerMutable+B")); } [Test] public void TestCtorExceptionDupes() { Assert.That(() => new ServicesContainerMutable(new List { new A(), new B(), new A() }, typeof(B).FullName), Throws.InstanceOf()); } [Test] public void TestCtorExceptionActiveNotFound() { Assert.That(() => new ServicesContainerMutable(new List { new A(), new B() }, "C"), Throws.InstanceOf()); } [Test] public void TestSetActive() { var container = new ServicesContainerMutable(new List { new A(), new B() }, typeof(B).FullName); container.SetActive(typeof(A).FullName); Assert.That(container.Active.GetType().FullName, Is.EqualTo("TestTINKLib.Fixtures.ObjectTests.Services.TestServicesContainerMutable+A")); } private class A { } private class B { } } }