mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
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<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 ServicesContainerMutable<object>(new List<object> { new A(), new B(), new A() }, typeof(B).FullName), Throws.InstanceOf<Exception>());
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorExceptionActiveNotFound()
|
|
{
|
|
Assert.That(() => new ServicesContainerMutable<object>(new List<object> { new A(), new B() }, "C"), Throws.InstanceOf<ArgumentException>());
|
|
}
|
|
|
|
[Test]
|
|
public void TestSetActive()
|
|
{
|
|
var container = new ServicesContainerMutable<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
|
|
{ }
|
|
}
|
|
}
|