protected string ComplexPropertyDeclarationOnSelf(GivenClassComplexProperty excelGivenProperty)
        {
            var classVariableName = excelGivenProperty.Name;
            var variableType      = $"SpecificationSpecific{excelGivenProperty.ClassName}";

            return($"        public {variableType} {classVariableName} {{ get; private set; }}");
        }
        protected string ComplexPropertySetterOnSelf(GivenClassComplexProperty excelGivenProperty)
        {
            var functionName      = $"{excelGivenProperty.Name}_of";
            var classVariableName = excelGivenProperty.Name;
            var parameterName     = CamelCase(excelGivenProperty.Name);
            var propertyClassName = $"SpecificationSpecific{excelGivenProperty.ClassName}";

            return
                ($@"        internal {SpecificationSpecificClassName} {functionName}({propertyClassName} {parameterName})
        {{
            AddClassProperty(new ReportSpecificationSetupClass(GetCurrentMethod(), {parameterName}));

            this.{classVariableName} = {parameterName};

            return this;
        }}{NewLine}");
        }
Esempio n. 3
0
        IReadOnlyList <IGivenClassProperty> RationaliseProperties(
            IReadOnlyList <IVisitedGivenSimpleProperty> rationalisedGivenSimpleProperties,
            IReadOnlyList <IVisitedGivenComplexProperty> rationalisedGivenComplexProperties,
            IReadOnlyList <IVisitedGivenFunction> rationalisedGivenFunctions,
            IReadOnlyList <IVisitedGivenListProperty> rationalisedGivenListProperties,
            IReadOnlyList <IVisitedGivenTableProperty> rationalisedGivenTableProperties
            )
        {
            properties.Clear();
            givenSimpleProperties.Clear();

            foreach (var givenComplexProperty in rationalisedGivenComplexProperties)
            {
                var complexProperty =
                    new GivenClassComplexProperty(
                        givenComplexProperty.PropertyName,
                        givenComplexProperty.ClassName);

                givenComplexProperties.Add(complexProperty);
                AddProperty(complexProperty);
            }

            foreach (var givenSimpleProperty in rationalisedGivenSimpleProperties)
            {
                var simpleProperty =
                    new GivenClassSimpleProperty(
                        givenSimpleProperty.PropertyOrFunctionName,
                        givenSimpleProperty.ExcelPropertyType,
                        givenSimpleProperty.CsharpCodeRepresentation,
                        givenSimpleProperty.Nullable
                        );

                givenSimpleProperties.Add(simpleProperty);
                AddProperty(simpleProperty);
            }

            foreach (var givenFunction in rationalisedGivenFunctions)
            {
                var function = new GivenClassFunction(givenFunction.PropertyOrFunctionName);

                givenFunctions.Add(function);
                AddProperty(function);
            }

            foreach (var givenListProperty in rationalisedGivenListProperties)
            {
                var complexListProperty =
                    new GivenClassComplexListProperty(
                        givenListProperty.PropertyName,
                        givenListProperty.ClassName);

                givenComplexListProperties.Add(complexListProperty);
                AddProperty(complexListProperty);
            }

            foreach (var givenTableProperty in rationalisedGivenTableProperties)
            {
                var complexListProperty =
                    new GivenClassComplexListProperty(
                        givenTableProperty.PropertyName,
                        givenTableProperty.ClassName);

                givenComplexListProperties.Add(complexListProperty);
                AddProperty(complexListProperty);
            }

            return(properties);
        }
 string NonMatchingProperty(GivenClassComplexProperty givenClassProperty)
 {
     return($"// Could not match {givenClassProperty.Name}, please add this in a custom partial class, or override this file entirely, by creating a file in the Setup subfolder called {givenClassProperty.ClassName}Override.cs");
 }