mirror of https://github.com/AMT-Cheif/Stylet.git
31 lines
697 B
C#
31 lines
697 B
C#
using NUnit.Framework;
|
|
using StyletIoC;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StyletUnitTests.StyletIoC
|
|
{
|
|
[TestFixture]
|
|
public class StyletIoCInstanceBindingTests
|
|
{
|
|
interface I1 { }
|
|
class C1 : I1 { }
|
|
|
|
[Test]
|
|
public void InstanceBindingUsesInstanceToResolve()
|
|
{
|
|
var c1 = new C1();
|
|
|
|
var builder = new StyletIoCBuilder();
|
|
builder.Bind<I1>().ToInstance(c1);
|
|
var ioc = builder.BuildContainer();
|
|
|
|
Assert.AreEqual(c1, ioc.Get<I1>());
|
|
Assert.AreEqual(c1, ioc.Get<I1>());
|
|
}
|
|
}
|
|
}
|