Exemple #1
0
        public void resolves_components_with_ctor_with_dependencies()
        {
            var container = new YetiContainer();

            container.Register <Dependecy, Dependecy>();
            container.Register <ITestInterface, TestImplementationWithDepenedncy>();

            var resolved_object = container.Resolve <ITestInterface>();

            resolved_object.ShouldBeOfType <TestImplementationWithDepenedncy>();
        }
Exemple #2
0
        public void throw_when_components_has_multiple_ctor()
        {
            var container = new YetiContainer();

            container.Register <Dependecy, Dependecy>();
            container.Register <ITestInterface, TestImplementationWithMultipleCtor>();

            var exc = Record.Exception(() => container.Resolve <ITestInterface>());

            exc.ShouldNotBeNull();
            exc.ShouldBeOfType <ComponentHasMultipleConstructorException>();
        }
Exemple #3
0
        public void resolves_registered_components()
        {
            var container = new YetiContainer();

            container.Register <ITestInterface, TestImplementation>();

            var resolved_object = container.Resolve <ITestInterface>();

            resolved_object.ShouldBeOfType <TestImplementation>();
        }