mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
Initial version
This commit is contained in:
parent
41b618cb27
commit
e4fb48f6ab
24 changed files with 4387 additions and 0 deletions
68
TestShareeLib/Services/TestServicesContainerMutable.cs
Normal file
68
TestShareeLib/Services/TestServicesContainerMutable.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Services;
|
||||
|
||||
namespace TestShareeLib.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestServicesContainerMutable
|
||||
{
|
||||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
var typeA = new MyTypeA();
|
||||
var typeB = new MyTypeB();
|
||||
|
||||
var serviceContainer = new ServicesContainerMutable<object>(
|
||||
new List<object> { typeA, typeB, typeB },
|
||||
typeA.GetType().FullName);
|
||||
|
||||
Assert.That(
|
||||
serviceContainer,
|
||||
Is.EqualTo(new List<object> { typeA, typeB}).AsCollection);
|
||||
|
||||
Assert.That(
|
||||
serviceContainer.Active,
|
||||
Is.EqualTo(typeA));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetActive()
|
||||
{
|
||||
var typeA = new MyTypeA();
|
||||
var typeB = new MyTypeB();
|
||||
|
||||
var serviceContainer = new ServicesContainerMutable<object>(
|
||||
new List<object> { typeA, typeB },
|
||||
typeA.GetType().FullName);
|
||||
|
||||
serviceContainer.SetActive(typeB.GetType().FullName);
|
||||
|
||||
Assert.That(
|
||||
serviceContainer.Active,
|
||||
Is.EqualTo(typeB));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetActiveNotExists()
|
||||
{
|
||||
var typeA = new MyTypeA();
|
||||
var typeB = new MyTypeB();
|
||||
|
||||
var serviceContainer = new ServicesContainerMutable<object>(
|
||||
new List<object> { typeA, typeB },
|
||||
typeA.GetType().FullName);
|
||||
|
||||
Assert.That(
|
||||
() => serviceContainer.SetActive(new MyTypeC().GetType().FullName),
|
||||
Throws.TypeOf<ArgumentException>());
|
||||
}
|
||||
|
||||
private class MyTypeA {}
|
||||
|
||||
private class MyTypeB { }
|
||||
|
||||
private class MyTypeC { }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue