public void Test_GenerateValue_WhenListEmpty_ShouldGenerateRandomString()
        {
            //---------------Set up test pack-------------------

            ValidValueGenerator valueGenerator = CreateNameValidValueGenerator(GetPropDef(), GetEmptyList());
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            object value = valueGenerator.GenerateValidValue();

            //---------------Test Result -----------------------
            Assert.IsNotNull(value);
        }
Ejemplo n.º 2
0
        public void Test_RegisterCustomBOTestFactory_ShouldReturnWhenResolved()
        {
            //---------------Set up test pack-------------------
            var registry = new ValidValueGeneratorRegistry();

            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <ValidValueGeneratorString>(registry.Resolve(GetStringPropDef()));
            //---------------Execute Test ----------------------
            registry.Register <string, ValidValueGeneratorInt>();
            ValidValueGenerator validValueGenerator = registry.Resolve(GetStringPropDef());

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <ValidValueGeneratorInt>(validValueGenerator);
        }
Ejemplo n.º 3
0
        public void Test_RegisterCustomBOTestFactory_ForAPropDef_ShouldReturnWhenResolved()
        {
            //---------------Set up test pack-------------------
            var registry      = new BOPropValueGeneratorRegistry();
            var stringPropDef = GetStringPropDef();

            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <ValidValueGeneratorString>(registry.Resolve(stringPropDef));
            //---------------Execute Test ----------------------
            registry.Register(stringPropDef, typeof(ValidValueGeneratorIncrementalInt));
            ValidValueGenerator validValueGenerator = registry.Resolve(stringPropDef);

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <ValidValueGeneratorIncrementalInt>(validValueGenerator);
        }
Ejemplo n.º 4
0
        public void Test_RegisterCustomGenForTypeAndForPropDef_ShouldReturnPropDefRegistration()
        {
            //---------------Set up test pack-------------------
            var registry      = new BOPropValueGeneratorRegistry();
            var stringPropDef = GetStringPropDef();

            registry.Register(stringPropDef, typeof(ValidValueGeneratorInt));
            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <ValidValueGeneratorInt>(registry.Resolve(stringPropDef));
            //---------------Execute Test ----------------------
            registry.Register(stringPropDef, typeof(ValidValueGeneratorDecimal));
            ValidValueGenerator validValueGenerator = registry.Resolve(stringPropDef);

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <ValidValueGeneratorDecimal>(validValueGenerator);
        }
Ejemplo n.º 5
0
        public void Test_RegisterTwice_ForAPropDef_ShouldStoreSecond()
        {
            //---------------Set up test pack-------------------
            var registry      = new BOPropValueGeneratorRegistry();
            var stringPropDef = GetStringPropDef();

            registry.Register(stringPropDef, typeof(ValidValueGeneratorEnum));
            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <ValidValueGeneratorEnum>(registry.Resolve(stringPropDef));
            //---------------Execute Test ----------------------
            registry.Register(stringPropDef, typeof(ValidValueGeneratorDecimal));
            ValidValueGenerator validValueGenerator = registry.Resolve(stringPropDef);

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <ValidValueGeneratorDecimal>(validValueGenerator);
        }
Ejemplo n.º 6
0
        public void Test_Resolve_WhenNoPropDefRegistered_ShouldReturnForType()
        {
            //---------------Set up test pack-------------------
            var registry = new BOPropValueGeneratorRegistry();

            var stringPropDef1 = GetStringPropDef();

            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <ValidValueGeneratorString>(registry.Resolve(stringPropDef1));
            //---------------Execute Test ----------------------
            ValidValueGeneratorRegistry.Instance.Register <string, ValidValueGeneratorInt>();
            ValidValueGenerator validValueGenerator1 = registry.Resolve(stringPropDef1);

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <ValidValueGeneratorInt>(validValueGenerator1);
        }
Ejemplo n.º 7
0
        public void Test_RegisterTwice_ShouldStoreSecond()
        {
            //---------------Set up test pack-------------------
            var registry = new ValidValueGeneratorRegistry();

            registry.Register <string, ValidValueGeneratorString>();
            //---------------Assert Precondition----------------
            Assert.IsNotNull(registry.Resolve(GetStringPropDef()));
            //---------------Execute Test ----------------------
            registry.Register <string, ValidValueGeneratorDecimal>();
            ValidValueGenerator validValueGenerator = registry.Resolve(GetStringPropDef());

            //---------------Test Result -----------------------
            Assert.IsNotInstanceOf <ValidValueGeneratorString>(validValueGenerator);
            Assert.IsInstanceOf <ValidValueGeneratorDecimal>(validValueGenerator);
        }
Ejemplo n.º 8
0
        public void Test_Register_WhenStdValidValueGenerator_WithValueGen_ShouldReturnWhenResolved()
        {
            //---------------Set up test pack-------------------
            var registry = new ValidValueGeneratorRegistry();

            registry.Register <string>(typeof(ValidValueGeneratorString));
            PropDefFake propDef = new PropDefFake();

            propDef.PropertyType = typeof(string);
            //---------------Assert Precondition----------------
            Assert.AreSame(typeof(string), propDef.PropertyType);
            //---------------Execute Test ----------------------
            ValidValueGenerator boTestFactory = registry.Resolve(propDef);

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <ValidValueGeneratorString>(boTestFactory);
        }
Ejemplo n.º 9
0
        public void Test_ResolveForDifPropDefShouldReturnDefaultValidValGen()
        {
            //---------------Set up test pack-------------------
            var registry = new BOPropValueGeneratorRegistry();

            ValidValueGeneratorRegistry.Instance.Register <string, ValidValueGeneratorInt>();
            var stringPropDef1 = GetStringPropDef();
            var stringPropDef2 = GetStringPropDef();

            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <ValidValueGeneratorInt>(registry.Resolve(stringPropDef1));
            Assert.IsInstanceOf <ValidValueGeneratorInt>(registry.Resolve(stringPropDef2));
            //---------------Execute Test ----------------------
            registry.Register(stringPropDef1, typeof(ValidValueGeneratorDecimal));
            ValidValueGenerator validValueGenerator1 = registry.Resolve(stringPropDef1);
            ValidValueGenerator validValueGenerator2 = registry.Resolve(stringPropDef2);

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <ValidValueGeneratorDecimal>(validValueGenerator1);
            Assert.IsInstanceOf <ValidValueGeneratorInt>(validValueGenerator2);
        }