示例#1
0
        public void String_Selector_Injects_All_Strings()
        {
            var stringSelector     = new StringSelector();
            var randomStringsClass = new RandomStringsClass();

            //Iterate over all of the properties in the fullNameClass object...
            foreach (var property in randomStringsClass.GetType().GetProperties())
            {
                //Inject the value into the property
                stringSelector.Generate(randomStringsClass, property);
            }

            //Iterate over all of the properties again
            foreach (var property in randomStringsClass.GetType().GetProperties())
            {
                var fieldValue = property.GetValue(randomStringsClass, null) as string;

                Assert.IsNotNullOrEmpty(fieldValue);
                Assert.IsAssignableFrom <string>(fieldValue, "Should be type of string...");
                Assert.That(fieldValue.Length > 0);
            }
        }
        public void String_Selector_Injects_All_Strings()
        {
            var stringSelector = new StringSelector();
            var randomStringsClass = new RandomStringsClass();

            //Iterate over all of the properties in the fullNameClass object...
            foreach (var property in randomStringsClass.GetType().GetProperties())
            {
                //Inject the value into the property
                stringSelector.Generate(randomStringsClass, property);
            }

            //Iterate over all of the properties again
            foreach (var property in randomStringsClass.GetType().GetProperties())
            {
                var fieldValue = property.GetValue(randomStringsClass, null) as string;

                Assert.IsNotNullOrEmpty(fieldValue);
                Assert.IsAssignableFrom<string>(fieldValue, "Should be type of string...");
                Assert.That(fieldValue.Length > 0);
            }
        }