protected string SimplePropertyDeclarationOnSelf(GivenClassSimpleProperty excelGivenProperty)
        {
            var parameterName = excelGivenProperty.Name;
            var parameterType = CsharpPropertyTypeName(excelGivenProperty.Type, excelGivenProperty.ExampleValue, excelGivenProperty.Nullable);

            return($"        public {parameterType} {parameterName} {{ get; private set; }}");
        }
        protected string SimplePropertySetterOnSelf(GivenClassSimpleProperty excelGivenProperty)
        {
            var parameterName     = CamelCase(excelGivenProperty.Name);
            var parameterType     = CsharpPropertyTypeName(excelGivenProperty.Type, excelGivenProperty.ExampleValue, excelGivenProperty.Nullable);
            var classPropertyName = excelGivenProperty.Name;

            return
                ($@"        internal {SpecificationSpecificClassName} {excelGivenProperty.Name}_of({parameterType} {parameterName})
        {{
            AddValueProperty(GetCurrentMethod(), {parameterName});

            this.{classPropertyName} = {parameterName};

            return this;
        }}{NewLine}");
        }
Beispiel #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);
        }