Beispiel #1
0
        public static string ListOutKeyProperties(string prefix, ISpecificationKey key)
        {
            string propertiesListed = string.Empty;

            if (key != null)
            {
                for (int i = 0; i < key.SpecificationProperties.Count; i++)
                {
                    if (i > 0)
                    {
                        propertiesListed += ", ";
                    }

                    if (!string.IsNullOrEmpty(prefix))
                    {
                        propertiesListed += prefix + key.SpecificationProperties[i].Name;
                    }
                    else
                    {
                        propertiesListed += key.SpecificationProperties[i].InstanceName;
                    }
                }
            }

            return(propertiesListed);
        }
Beispiel #2
0
        public static string MockOutProperty(ISpecification specification, ISpecificationModel modelUnderTest, ModelComponent component, ISpecificationKey key, ISpecificationProperty specificationProperty, string referenceName)
        {
            string _value = null;

            if (component == ModelComponent.Model && specificationProperty.PropertyType == modelUnderTest.Interface.VariableType.Name)
            {
                _value = RandomValue(specification, specificationProperty, false, false);
            }
            else
            {
                _value = RandomValue(specification, specificationProperty, true, false);
            }

            if (specificationProperty.Relationship != null)
            {
                return(MockOutProperty(key.InstanceName, specificationProperty.Name, referenceName, specificationProperty.PropertyType, "() => { return " + _value + "; }"));
            }

            return(MockOutProperty(key.InstanceName, specificationProperty.Name, referenceName, specificationProperty.PropertyType, _value));
        }
Beispiel #3
0
 public static string ListOutKeyProperties(ISpecificationKey key)
 {
     return(TestingHelper.ListOutKeyProperties(string.Empty, key));
 }