Пример #1
0
        public void Should_pull_the_implementation_for_the_type()
        {
            ComponentFactory.Add <IMyDependency>(typeof(MyDependency));

            var subject = ComponentFactory.Get <MyClass>();

            Assert.IsNotNull(subject);
            Assert.IsNotNull(subject.Dependency);
            Assert.IsInstanceOf <MyDependency>(subject.Dependency);
            Assert.IsNotNull(subject.OtherDependency);
            Assert.IsNotNull(subject.Dependency.Dependency);
        }
Пример #2
0
 public void Setup()
 {
     ComponentFactory.Add(typeof(MyClass), typeof(MyClass), new[] { typeof(MyDependency) });
 }
Пример #3
0
 public void Setup()
 {
     ComponentFactory.Add <MyClass>();
 }
Пример #4
0
 public void Should_throw_an_exception()
 {
     Assert.Throws <ArgumentException>(() => ComponentFactory.Add(typeof(IB), typeof(A)));
 }