public List <LoadManagerRule> LoadRules()
        {
            Logging            log    = new Logging();
            ReferenceGenerator refGen = new ReferenceGenerator();
            string             refNum = refGen.GenerateReference();

            List <LoadManagerRule> loadManagerRules = new List <LoadManagerRule>();

            try
            {
                LoadManagerRuleRepository loadManagerRuleRepo = new LoadManagerRuleRepository();
                var rules = loadManagerRuleRepo.LoadRules();

                // Check and filter rules
                foreach (var item in rules)
                {
                    loadManagerRules.Add(item);
                }
            }
            catch (Exception ex)
            {
                log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex);
                loadManagerRules = new List <LoadManagerRule>();
            }

            return(loadManagerRules);
        }
示例#2
0
        public List <LoadManagerErrors> SaveScrapeData(List <ScrapeData> scrapedData)
        {
            ReferenceGenerator refGen = new ReferenceGenerator();
            string             refNum = refGen.GenerateReference();

            List <LoadManagerErrors> loadManagerErrors = new List <LoadManagerErrors>();
            Logging log            = new Logging();
            int     rowsSavedCount = 0;

            try
            {
                foreach (ScrapeData data in scrapedData)
                {
                    int dataSaved = dataConnection.ExecuteStatement("Insert each scraped row of data in the DB");
                    rowsSavedCount = rowsSavedCount + dataSaved;
                }

                log.LogMessage(Enumeration.LoggingPriority.Low, refNum, rowsSavedCount.ToString() + " scraped data rows stored in DB");

                loadManagerErrors.Add(new LoadManagerErrors {
                    ErrorCode = 00, ErrorDescription = "Scraped Data Saved", Message = rowsSavedCount.ToString() + " records saved"
                });
            }
            catch (Exception ex)
            {
                log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex);

                loadManagerErrors.Add(new LoadManagerErrors {
                    ErrorCode = 91, ErrorDescription = "Error Occured", Message = ex.InnerException.Message
                });
            }

            return(loadManagerErrors);
        }
示例#3
0
        public bool Start(BillingCompanyInfo billingCompanyInfo)
        {
            bool               result = false;
            Logging            log    = new Logging();
            ReferenceGenerator refGen = new ReferenceGenerator();
            string             refNum = refGen.GenerateReference();

            try
            {
                // Load all the rules for the LoadManager
                LoadManagerRules       loadManagerRules = new LoadManagerRules();
                List <LoadManagerRule> rules            = loadManagerRules.LoadRules();

                // Call the scrape session to initialise the scrape
                ScrapeSession scrapeSession = new ScrapeSession();
                scrapeSession.CreateScrapeSession(rules, billingCompanyInfo);
                result = true;
            }
            catch (Exception ex)
            {
                result = false;
                log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex);
            }

            return(result);
        }
示例#4
0
        public void Test_CreateModelClass()
        {
            var classBuilder = new ClassBuilder("Cat", "Models");
            var @class       = classBuilder
                               .WithUsings("System")
                               .WithConstructor(
                ConstructorGenerator.Create(
                    "Cat",
                    BodyGenerator.Create(
                        Statement.Declaration.Assign("Name", ReferenceGenerator.Create(new VariableReference("name"))),
                        Statement.Declaration.Assign("Age", ReferenceGenerator.Create(new VariableReference("age")))),
                    new List <Parameter> {
                new Parameter("name", typeof(string)), new Parameter("age", typeof(int))
            },
                    new List <Modifiers> {
                Modifiers.Public
            }))
                               .WithProperties(
                PropertyGenerator.Create(new AutoProperty("Name", typeof(string), PropertyTypes.GetAndSet, new List <Modifiers> {
                Modifiers.Public
            })),
                PropertyGenerator.Create(new AutoProperty("Age", typeof(int), PropertyTypes.GetAndSet, new List <Modifiers> {
                Modifiers.Public
            })))
                               .Build();

            Assert.AreEqual(
                "usingSystem;namespaceModels{publicclassCat{publicCat(stringname,intage){Name=name;Age=age;}publicstringName{get;set;}publicintAge{get;set;}}}",
                @class.ToString());
        }
        /// <summary>
        /// Get the correct equals value clause for a specific type
        /// </summary>
        /// <param name="value">Value we want to put the variable equal as</param>
        /// <returns>The correct equals value clause</returns>
        internal static EqualsValueClauseSyntax GetEqualsValueClause(object value)
        {
            if (value is int)
            {
                return(EqualsValueClause(
                           LiteralExpression(
                               SyntaxKind.NumericLiteralExpression,
                               Literal(TriviaList(), value.ToString(), (int)value, TriviaList()))));
            }

            if (value is string)
            {
                return(EqualsValueClause(
                           LiteralExpression(
                               SyntaxKind.StringLiteralExpression,
                               Literal(TriviaList(), value.ToString(), (string)value, TriviaList()))));
            }

            if (value is VariableReference)
            {
                return(EqualsValueClause(ReferenceGenerator.Create((VariableReference)value)));
            }

            throw new NotSupportedException("Not a supported value");
        }
                private ReferenceGenerator GetReferenceGenerator(ISymbol typeParameterContext)
                {
                    if (_referenceGenerator == null || _referenceGenerator.TypeParameterContext != typeParameterContext)
                    {
                        _referenceGenerator = new ReferenceGenerator(_builder, typeParameterContext);
                    }

                    return(_referenceGenerator);
                }
示例#7
0
        /// <summary>
        /// Create the return statement syntax to return of a reference.
        /// </summary>
        /// <param name="variableReference">Reference that we should return.</param>
        /// <returns>The declared return statement syntax.</returns>
        public ReturnStatementSyntax Return(VariableReference variableReference)
        {
            if (variableReference == null)
            {
                throw new ArgumentNullException(nameof(variableReference));
            }

            return(ReturnStatement(ReferenceGenerator.Create(variableReference)));
        }
        public bool CreateLoadManager(BillingCompanyInfo billingCompanyInfo)
        {
            ReferenceGenerator refNumber = new ReferenceGenerator();
            string             refNum    = refNumber.GenerateReference();

            LoadManager loadManager = new LoadManager();

            loadManager.Start(billingCompanyInfo);

            return(true);
        }
示例#9
0
        private void RequestCreateHotelBooking(object s, EventArgs e)
        {
            HotelBook hotelBook = view.HotelBookDTO.HotelBook;

            hotelBook.Reference = ReferenceGenerator.Generate(6);   // Generates 6-character reference key.

            hotelBookingRepository.BookHotel(hotelBook);
            hotelRoomRepository.SetHotelInavailablity(hotelBook.HotelID, hotelBook.CheckOut);

            referenceView.DisplayBookingReference(hotelBook.Reference);
            view.CloseView();
        }
 protected OrderSaleEnvelopeContext(long sequenceNumber, Outlet outlet, User user, CostCentre costCentre, Order order)
 {
     Outlet = outlet;
     User = user;
     CostCentre = costCentre;
     Order = order;
     var dateTime = DateTime.Now;
     //Remove milliseconds
     Now = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second);
     ReferenceGenerator = new ReferenceGenerator(sequenceNumber, user, outlet, Now);
     VisitId = Guid.NewGuid();
 }
        /// <summary>
        /// Creates an id string used to reference type symbols (not strictly declarations, includes
        /// arrays, pointers, type parameters, etc.)
        /// </summary>
        public static string CreateReferenceId(ISymbol symbol)
        {
            if (symbol is INamespaceSymbol)
            {
                return(CreateDeclarationId(symbol));
            }

            var builder   = new StringBuilder();
            var generator = new ReferenceGenerator(builder, typeParameterContext: null);

            generator.Visit(symbol);
            return(builder.ToString());
        }
示例#12
0
        /// <summary>
        /// Create the expression statement syntax to assign a variable to another reference.
        /// </summary>
        /// <param name="name">Name of variable.</param>
        /// <param name="reference">Reference value to assign to the variable.</param>
        /// <param name="castTo">If we should do a cast while assign the variable.</param>
        /// <returns>The generated assign declaration syntax.</returns>
        public ExpressionStatementSyntax Assign(string name, VariableReference reference, Type castTo = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(name));
            }

            if (reference == null)
            {
                throw new ArgumentNullException(nameof(reference));
            }

            return(Assign(name, ReferenceGenerator.Create(reference), castTo));
        }
示例#13
0
        public void Test_CreateModelClassWithBodyProperties()
        {
            var classBuilder = new ClassBuilder("Cat", "Models");
            var @class       = classBuilder
                               .WithUsings("System")
                               .WithFields(
                new Field("_name", typeof(string), new List <Modifiers>()
            {
                Modifiers.Private
            }),
                new Field("_age", typeof(int), new List <Modifiers>()
            {
                Modifiers.Private
            }))
                               .WithConstructor(
                ConstructorGenerator.Create(
                    "Cat",
                    BodyGenerator.Create(
                        Statement.Declaration.Assign("Name", ReferenceGenerator.Create(new VariableReference("name"))),
                        Statement.Declaration.Assign("Age", ReferenceGenerator.Create(new VariableReference("age")))),
                    new List <Parameter> {
                new Parameter("name", typeof(string)), new Parameter("age", typeof(int))
            },
                    new List <Modifiers> {
                Modifiers.Public
            }))
                               .WithProperties(
                PropertyGenerator.Create(
                    new BodyProperty(
                        "Name",
                        typeof(string),
                        BodyGenerator.Create(Statement.Jump.Return(new VariableReference("_name"))), BodyGenerator.Create(Statement.Declaration.Assign("_name", new ValueKeywordReference())),
                        new List <Modifiers> {
                Modifiers.Public
            })),
                PropertyGenerator.Create(
                    new BodyProperty(
                        "Age",
                        typeof(int),
                        BodyGenerator.Create(Statement.Jump.Return(new VariableReference("_age"))), BodyGenerator.Create(Statement.Declaration.Assign("_age", new ValueKeywordReference())),
                        new List <Modifiers> {
                Modifiers.Public
            })))
                               .Build();

            Assert.AreEqual(
                "usingSystem;namespaceModels{publicclassCat{privatestring_name;privateint_age;publicCat(stringname,intage){Name=name;Age=age;}publicstringName{get{return_name;}set{_name=value;}}publicintAge{get{return_age;}set{_age=value;}}}}",
                @class.ToString());
        }
        /// <summary>
        /// Create the expression statement syntax to invoke a method in a chain (for example <c>myVariable.myProperty.MyMethod()</c>)
        /// </summary>
        /// <param name="reference">The reference chain.</param>
        /// <returns>A invocation object with both statement and expression.</returns>
        public Invocation Invoke(VariableReference reference)
        {
            if (reference == null)
            {
                throw new ArgumentNullException(nameof(reference));
            }

            if (!(reference is MethodReference))
            {
                var member = reference.GetLastMember();
                if (!(member is MethodReference))
                {
                    throw new ArgumentException($"{nameof(reference)} or last member in chain must be a method reference");
                }
            }

            return(new Invocation((InvocationExpressionSyntax)ReferenceGenerator.Create(reference)));
        }
示例#15
0
        /// <summary>
        /// Create the expression statement syntax to assign a reference to another reference. For example a property to a property.
        /// </summary>
        /// <param name="reference">Reference that should be assigned.</param>
        /// <param name="valueReference">Reference that we should assign to another reference.</param>
        /// <param name="castTo">If we should do a cast while assign the variabl.</param>
        /// <returns>The generated assign declaration syntax.</returns>
        public ExpressionStatementSyntax Assign(VariableReference reference, VariableReference valueReference, Type castTo = null)
        {
            if (reference == null)
            {
                throw new ArgumentNullException(nameof(reference));
            }

            if (valueReference == null)
            {
                throw new ArgumentNullException(nameof(valueReference));
            }

            if (reference is MethodReference || reference.GetLastMember() is MethodReference)
            {
                throw new ArgumentException($"{nameof(reference)} to assign can't be a method");
            }

            return(Assign(reference, ReferenceGenerator.Create(valueReference), castTo));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConditionalBinaryExpression"/> class.
        /// </summary>
        /// <param name="leftReference">The left reference.</param>
        /// <param name="rightReference">The right reference.</param>
        /// <param name="conditional">The conditional statement between two expressions.</param>
        public ConditionalBinaryExpression(
            VariableReference leftReference,
            VariableReference rightReference,
            ConditionalStatements conditional)
        {
            if (leftReference == null)
            {
                throw new ArgumentNullException(nameof(leftReference));
            }

            if (rightReference == null)
            {
                throw new ArgumentNullException(nameof(rightReference));
            }

            _leftExpression  = ReferenceGenerator.Create(leftReference);
            _rightExpression = ReferenceGenerator.Create(rightReference);
            _conditional     = conditional;
        }
示例#17
0
        /// <summary>
        /// Create the expression statement syntax to assign a reference to a binary expression.
        /// </summary>
        /// <param name="reference">Reference that should be assigned.</param>
        /// <param name="binaryExpression">The binary expression.</param>
        /// <returns>The generated assign declaration syntax.</returns>
        public ExpressionStatementSyntax Assign(VariableReference reference, IBinaryExpression binaryExpression)
        {
            if (reference == null)
            {
                throw new ArgumentNullException(nameof(reference));
            }

            if (binaryExpression == null)
            {
                throw new ArgumentNullException(nameof(binaryExpression));
            }

            return
                (ExpressionStatement(
                     AssignmentExpression(
                         SyntaxKind.SimpleAssignmentExpression,
                         ReferenceGenerator.Create(reference),
                         binaryExpression.GetBinaryExpression())));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MathBinaryExpression"/> class.
        /// </summary>
        /// <param name="leftReference">The left reference.</param>
        /// <param name="rightBinaryExpression">The right other binary expression.</param>
        /// <param name="mathOperator">The math operator to generate.</param>
        /// <param name="useParenthes">If we should generate with paranthes surounding the the binary expression.</param>
        public MathBinaryExpression(
            VariableReference leftReference,
            MathBinaryExpression rightBinaryExpression,
            MathOperators mathOperator,
            bool useParenthes = false)
        {
            if (leftReference == null)
            {
                throw new ArgumentNullException(nameof(leftReference));
            }

            if (rightBinaryExpression == null)
            {
                throw new ArgumentNullException(nameof(rightBinaryExpression));
            }

            _leftExpression  = ReferenceGenerator.Create(leftReference);
            _rightExpression = rightBinaryExpression.GetBinaryExpression();
            _mathOperator    = mathOperator;
            _useParenthes    = useParenthes;
        }
示例#19
0
        public List <LoadManagerRule> LoadRules()
        {
            Logging            log    = new Logging();
            ReferenceGenerator refGen = new ReferenceGenerator();
            string             refNum = refGen.GenerateReference();

            List <LoadManagerRule> listRules = new List <LoadManagerRule>();

            try
            {
                // This retrieves all Load Manager Rules via the DBConnetion
                listRules = new List <LoadManagerRule>();
            }
            catch (Exception ex)
            {
                log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex);

                listRules.Add(new LoadManagerRule());
            }

            return(listRules);
        }
        public void CanGenerateIdsForMakeSale()
        {
            var sequence = new DatabaseSequence() { SequenceName = SequenceName.DocumentReference, NextValue = 1};
            var generator = new ReferenceGenerator(sequence.NextValue, user, outlet, DateTime.Now);

            var sequenceNumber = sequence.NextValue;

            var saleId = generator.NextSaleReference();
            CompareParts(saleId, "S", "Juan", outlet.CostCentreCode, sequenceNumber);

            var orderId = generator.NextOrderReference();
            CompareParts(orderId, "O", "Juan", outlet.CostCentreCode, sequenceNumber);

            var invoiceId = generator.NextInvoiceReference();
            CompareParts(invoiceId, "I", "Juan", outlet.CostCentreCode, sequenceNumber);

            var receiptId = generator.NextReceiptReference();
            CompareParts(receiptId, "R", "Juan", outlet.CostCentreCode, sequenceNumber);

            var externalDocRef = generator.NextExternalDocumentReference();
            Assert.AreEqual("S001000001", externalDocRef, "external doc ref");
        }
示例#21
0
        /// <summary>
        /// Create the foreach statement syntax for a foreach loop with a reference as enumerable.
        /// </summary>
        /// <param name="variableName">Name of the variable.</param>
        /// <param name="varialeType">The variable type.</param>
        /// <param name="enumerableReference">Reference to the enumerable.</param>
        /// <param name="body">Body of the foreach loop.</param>
        /// <param name="useVar">If we should use the var keyword instead of the type.</param>
        /// <returns>The declared foreach statement syntax.</returns>
        public ForEachStatementSyntax ForEach(string variableName, Type varialeType, VariableReference enumerableReference, BlockSyntax body, bool useVar = true)
        {
            if (string.IsNullOrEmpty(variableName))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(variableName));
            }

            if (varialeType == null)
            {
                throw new ArgumentNullException(nameof(varialeType));
            }

            if (enumerableReference == null)
            {
                throw new ArgumentNullException(nameof(enumerableReference));
            }

            return(ForEachStatement(
                       useVar ? IdentifierName("var") : TypeGenerator.Create(varialeType),
                       Identifier(variableName),
                       ReferenceGenerator.Create(enumerableReference),
                       body));
        }
示例#22
0
        /// <summary>
        /// Create the expression statement syntax to assign a reference to another expression.
        /// </summary>
        /// <param name="reference">Reference that should be assigned.</param>
        /// <param name="expressionSyntax">Expression that we should assign to reference.</param>
        /// <param name="castTo">If we should do a cast while assign the variable.</param>
        /// <returns>The generated assign declaration syntax.</returns>
        public ExpressionStatementSyntax Assign(VariableReference reference, ExpressionSyntax expressionSyntax, Type castTo = null)
        {
            if (reference == null)
            {
                throw new ArgumentNullException(nameof(reference));
            }

            if (expressionSyntax == null)
            {
                throw new ArgumentNullException(nameof(expressionSyntax));
            }

            if (castTo != null && castTo != typeof(void))
            {
                expressionSyntax = CastExpression(TypeGenerator.Create(castTo), expressionSyntax);
            }

            return
                (ExpressionStatement(
                     AssignmentExpression(
                         SyntaxKind.SimpleAssignmentExpression,
                         ReferenceGenerator.Create(reference),
                         expressionSyntax)));
        }
示例#23
0
        /// <summary>
        /// Create the for statement syntax for a for loop with a reference for start and stop.
        /// </summary>
        /// <param name="start">Reference for start.</param>
        /// <param name="end">Reference for end.</param>
        /// <param name="variableName">Variable name in loop.</param>
        /// <param name="body">Body inside loop.</param>
        /// <returns>The declared for statement syntax.</returns>
        public ForStatementSyntax For(VariableReference start, VariableReference end, string variableName, BlockSyntax body)
        {
            if (start == null)
            {
                throw new ArgumentNullException(nameof(start));
            }

            if (end == null)
            {
                throw new ArgumentNullException(nameof(end));
            }

            if (string.IsNullOrEmpty(variableName))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(variableName));
            }

            return(ForStatement(
                       VariableDeclaration(
                           PredefinedType(Token(SyntaxKind.IntKeyword)), SeparatedList(new[]
            {
                VariableDeclarator(
                    Identifier(variableName),
                    null,
                    EqualsValueClause(ReferenceGenerator.Create(start)))
            })),
                       SeparatedList <ExpressionSyntax>(),
                       BinaryExpression(
                           SyntaxKind.LessThanExpression,
                           IdentifierName(variableName),
                           ReferenceGenerator.Create(end)),
                       SeparatedList <ExpressionSyntax>(new[]
            {
                PostfixUnaryExpression(SyntaxKind.PostIncrementExpression, IdentifierName(variableName))
            }), body));
        }
 public void Create_WhenCreatingVariableRefernceWithMethodMemberThatHasArgument_ShouldGenerateCorrectCode()
 {
     Assert.AreEqual("myVariable.MyMethod(1,\"test\")", ReferenceGenerator.Create(new VariableReference("myVariable", new MethodReference("MyMethod", new List <IArgument> {
         new ValueArgument(1), new ValueArgument("test")
     }))).ToString());
 }
 public void Create_WhenCreatingVariableRefernce_ShouldGenerateCorrectCode()
 {
     Assert.AreEqual("myVariable", ReferenceGenerator.Create(new VariableReference("myVariable")).ToString());
 }
示例#26
0
 public LandlordRepository()
 {
     _landLords = new List <LandLordViewModel>();
     generator  = new ReferenceGenerator();
 }
 protected override ArgumentSyntax CreateArgumentSyntax()
 {
     return(SyntaxFactory.Argument(ReferenceGenerator.Create(_reference)));
 }
 public void Create_WhenCreatingVariableRefernceWithPropertyMember_ShouldGenerateCorrectCode()
 {
     Assert.AreEqual("myVariable.Property", ReferenceGenerator.Create(new VariableReference("myVariable", new MemberReference("Property"))).ToString());
 }
示例#29
0
 public void Create_WhenCreatingFieldWithInitializer_ShouldGenerateCorrectCode()
 {
     Assert.AreEqual("ILogger_logger=LoggerService.Logger();", FieldGenerator.Create(new Field("_logger", CustomType.Create("ILogger"), initializeWith: ReferenceGenerator.Create(new VariableReference("LoggerService", new MethodReference("Logger"))))).ToString());
 }
示例#30
0
        public void Test_CreateClassWithMethodThatHaveMultipleSUmmarysAndSingleLineComments()
        {
            var classBuilder = new ClassBuilder("Cat", "Models");
            var @class       = classBuilder
                               .WithUsings("System")
                               .WithSummary("My class summary")
                               .WithConstructor(ConstructorGenerator.Create(
                                                    "Cat",
                                                    BodyGenerator.Create(
                                                        Statement.Declaration.Assign("Name", ReferenceGenerator.Create(new VariableReference("name"))),
                                                        Statement.Declaration.Assign("Age", ReferenceGenerator.Create(new VariableReference("age")))),
                                                    new List <Parameter> {
                new Parameter("name", typeof(string)), new Parameter("age", typeof(int), xmlDocumentation: "My parameter")
            },
                                                    new List <Modifiers> {
                Modifiers.Public
            },
                                                    summary: "MyConstructor summary"))
                               .WithProperties(new AutoProperty("MyProperty", typeof(int), PropertyTypes.GetAndSet, summary: "MyPropertySummary"))
                               .WithFields(
                new Field("_name", typeof(string), new List <Modifiers>()
            {
                Modifiers.Private
            }, summary: "My field summary"))
                               .WithMethods(new MethodBuilder("MyMethod")
                                            .WithParameters(new Parameter("MyParameter", typeof(string)))
                                            .WithBody(
                                                BodyGenerator.Create(
                                                    Statement.Declaration.Declare("hello", typeof(int)).WithComment("My comment above").WithComment("hej"),
                                                    Statement.Declaration.Declare("hello", typeof(int)).WithComment("My comment to the side", CommentPosition.Right)
                                                    ))
                                            .Build())
                               .Build();

            Assert.AreEqual(
                "usingSystem;namespaceModels{/// <summary>\n/// My class summary\n/// </summary>\npublicclassCat{/// <summary>\n/// MyConstructor summary\n/// </summary>\n/// <param name=\"age\">My parameter</param>\npublicCat(stringname,intage){Name=name;Age=age;}/// <summary>\n/// MyPropertySummary\n/// </summary>\nintMyProperty{get;set;}/// <summary>\n/// My field summary\n/// </summary>\nprivatestring_name;voidMyMethod(stringMyParameter){//hej\ninthello;inthello; //My comment to the side\n}}}",
                @class.ToString());
        }
 public void Create_WhenCreatingVariableRefernceWithChainedMembers_ShouldGenerateCorrectCode()
 {
     Assert.AreEqual("myVariable.MyMethod().MyProperty", ReferenceGenerator.Create(new VariableReference("myVariable", new MethodReference("MyMethod", new MemberReference("MyProperty"), new List <IArgument>()))).ToString());
 }
示例#32
0
        public void Test_CreateClassWithRegionWithMultipleMembers()
        {
            var classBuilder = new ClassBuilder("Cat", "Models");
            var @class       = classBuilder
                               .WithUsings("System")
                               .WithRegions(new RegionBuilder("MyRegion")
                                            .WithFields(
                                                new Field("_name", typeof(string), new List <Modifiers>()
            {
                Modifiers.Private
            }),
                                                new Field("_age", typeof(int), new List <Modifiers>()
            {
                Modifiers.Private
            }))
                                            .WithProperties(PropertyGenerator.Create(new AutoProperty("Name", typeof(string), PropertyTypes.GetAndSet, new List <Modifiers> {
                Modifiers.Public
            })))
                                            .WithConstructor(
                                                ConstructorGenerator.Create(
                                                    "Cat",
                                                    BodyGenerator.Create(
                                                        Statement.Declaration.Assign("Name", ReferenceGenerator.Create(new VariableReference("name"))),
                                                        Statement.Declaration.Assign("Age", ReferenceGenerator.Create(new VariableReference("age")))),
                                                    new List <Parameter> {
                new Parameter("name", typeof(string)), new Parameter("age", typeof(int))
            },
                                                    new List <Modifiers> {
                Modifiers.Public
            }))
                                            .Build())
                               .Build();

            Assert.AreEqual(
                "usingSystem;namespaceModels{publicclassCat{#region MyRegion \nprivatestring_name;privateint_age;publicstringName{get;set;}publicCat(stringname,intage){Name=name;Age=age;}#endregion}}",
                @class.ToString());
        }