Ejemplo n.º 1
0
        public void Instantiate_WithoutCtorParameter_Instantiated()
        {
            var factory  = new CustomConditionFactory();
            var instance = factory.Instantiate
                           (
                typeof(CustomConditionWithoutParameter),
                new ReadOnlyDictionary <string, object>(new Dictionary <string, object>())
                           );

            Assert.That(instance, Is.Not.Null);
            Assert.That(instance, Is.AssignableTo <ICustomCondition>());
        }
Ejemplo n.º 2
0
        public void Instantiate_MultipleConstructors_Instantiated()
        {
            var factory  = new CustomConditionFactory();
            var instance = factory.Instantiate
                           (
                typeof(CustomConditionWithMulipleCtors),
                new ReadOnlyDictionary <string, object>(new Dictionary <string, object>()
            {
                { "count", "5" },
                { "name", "myName" },
            })
                           );

            Assert.That(instance, Is.Not.Null);
            Assert.That(instance, Is.AssignableTo <ICustomCondition>());

            instance = factory.Instantiate
                       (
                typeof(CustomConditionWithMulipleCtors),
                new ReadOnlyDictionary <string, object>(new Dictionary <string, object>()
            {
                { "name", "myName" },
            })
                       );
            Assert.That(instance, Is.Not.Null);
            Assert.That(instance, Is.AssignableTo <ICustomCondition>());

            instance = factory.Instantiate
                       (
                typeof(CustomConditionWithMulipleCtors),
                new ReadOnlyDictionary <string, object>(new Dictionary <string, object>()
            {
            })
                       );
            Assert.That(instance, Is.Not.Null);
            Assert.That(instance, Is.AssignableTo <ICustomCondition>());
        }
Ejemplo n.º 3
0
        public void Instantiate_WithoutCtorTwoParametersIncorrectCase_Instantiated()
        {
            var factory  = new CustomConditionFactory();
            var instance = factory.Instantiate
                           (
                typeof(CustomConditionWithTwoParameters),
                new ReadOnlyDictionary <string, object>(new Dictionary <string, object>()
            {
                { "Count", "5" },
                { "naME", "myName" },
            })
                           );

            Assert.That(instance, Is.Not.Null);
            Assert.That(instance, Is.AssignableTo <ICustomCondition>());
        }