예제 #1
0
        public void SimpleClassAsT()
        {
            var dumbContainer = new DumbContainer();

            Action action = () => dumbContainer.Resolve <ITestClass>();

            action.Should().Throw <TryToResolveNotRegisteredTypeException>();
        }
예제 #2
0
        public void SimpleClassAsT()
        {
            var dumbContainer = new DumbContainer();

            Action register = () => dumbContainer.Register <ITestClass, TestClass>();

            register.Should().NotThrow();
        }
예제 #3
0
        public void SimpleClass()
        {
            var dumbContainer = new DumbContainer();

            var testClassType = typeof(TestClass);

            Action register = () => dumbContainer.Register(testClassType, testClassType);

            register.Should().NotThrow();
        }
예제 #4
0
        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);
        }
예제 #5
0
        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>();
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }