mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 15:16:34 +01:00
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using NUnit.Framework;
|
|
using TINK.Services;
|
|
|
|
namespace TestTINKLib.Fixtures.ObjectTests.Services
|
|
{
|
|
[TestFixture]
|
|
public class TestServicesContainerMutable
|
|
{
|
|
[Test]
|
|
public void TestCtor()
|
|
{
|
|
var container = new ServicesContainerMutableT<object>(new List<object> { 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 ServicesContainerMutableT<object>(new List<object> { new A(), new B(), new A() }, typeof(B).FullName), Throws.InstanceOf<Exception>());
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorExceptionActiveNotFound()
|
|
{
|
|
Assert.That(() => new ServicesContainerMutableT<object>(new List<object> { new A(), new B() }, "C"), Throws.InstanceOf<ArgumentException>());
|
|
}
|
|
|
|
[Test]
|
|
public void TestSetActive()
|
|
{
|
|
var container = new ServicesContainerMutableT<object>(new List<object> { 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
|
|
{ }
|
|
}
|
|
}
|