public void SimpleClassAsT() { var dumbContainer = new DumbContainer(); Action action = () => dumbContainer.Resolve <ITestClass>(); action.Should().Throw <TryToResolveNotRegisteredTypeException>(); }
public void SimpleClassAsT() { var dumbContainer = new DumbContainer(); var testClassType = typeof(TestClass); dumbContainer.Register(testClassType, testClassType); object resolve = dumbContainer.Resolve <TestClass>(); resolve.Should().NotBeNull(); resolve.Should().BeOfType(testClassType); }
public void SimpleClassAsT() { var dumbContainer = new DumbContainer(); dumbContainer.Register <TestClass, TestClass>(); dumbContainer.Register <InnerTestClass, InnerTestClass>(); var resolve = dumbContainer.Resolve <TestClass>(); resolve.Should().NotBeNull(); resolve.Should().BeOfType <TestClass>(); resolve.InnerTest.Should().NotBeNull(); resolve.InnerTest.Should().BeOfType <InnerTestClass>(); }
public void SimpleClass() { var dumbContainer = new DumbContainer(); var testClassType = typeof(TestClass); var innerTestClassType = typeof(InnerTestClass); dumbContainer.Register(testClassType, testClassType); dumbContainer.Register(innerTestClassType, innerTestClassType); var resolve = dumbContainer.Resolve(testClassType); resolve.Should().NotBeNull(); resolve.Should().BeOfType(testClassType); TestClass testClass = (TestClass)resolve; testClass.InnerTest.Should().NotBeNull(); testClass.InnerTest.Should().BeOfType(innerTestClassType); }
public void SimpleClass() { var dumbContainer = new DumbContainer(); var interfaceType = typeof(ITestClass); var testClassType = typeof(TestClass); var innerInterfaceType = typeof(IInnerTestClass); var innerTestClassType = typeof(InnerTestClass); dumbContainer.Register(interfaceType, testClassType); dumbContainer.Register(innerInterfaceType, innerTestClassType); var resolve = dumbContainer.Resolve(interfaceType); resolve.Should().NotBeNull(); resolve.Should().BeAssignableTo(interfaceType); ITestClass testClass = (ITestClass)resolve; testClass.InnerTest.Should().NotBeNull(); testClass.InnerTest.Should().BeAssignableTo(innerInterfaceType); }