Exemple #1
0
        public void RegisterService_NoConstructorValid()
        {
            var container    = new TinyContainer();
            var typeInstance = new EmptyConreteType();

            container.RegisterService <IInterfaceParam, InterfaceParam>();
            container.RegisterService <ConcreteTypeMultiParam>();

            var instance = container.ResolveService <ConcreteTypeMultiParam>();
        }
Exemple #2
0
        public void RegisterSingleton_WithInstanceTest()
        {
            var container    = new TinyContainer();
            var typeInstance = new EmptyConreteType();

            container.RegisterSingleton(typeInstance);

            var instance = container.ResolveService <EmptyConreteType>();

            Assert.AreEqual(instance, typeInstance);
        }
Exemple #3
0
        public void RegisterService_OnlyOneConstructorValid()
        {
            var container    = new TinyContainer();
            var typeInstance = new EmptyConreteType();

            container.RegisterService <SecondParam>();
            container.RegisterService <IInterfaceParam, InterfaceParam>();
            container.RegisterService <ConcreteTypeMultiParam>();

            var instance = container.ResolveService <ConcreteTypeMultiParam>();

            Assert.AreEqual(true, instance != null);
        }