示例#1
0
        public void While_WhenCreatingWhileLoopWithBinaryExpression_ShouldGenerateCode()
        {
            var binaryExpression = new ConditionalBinaryExpression(new ConstantReference(1), new ConstantReference(2),
                                                                   ConditionalStatements.LessThan);

            Assert.AreEqual("while(1<2){}", _control.While(binaryExpression, BodyGenerator.Create()).ToString());
        }
示例#2
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());
        }
示例#3
0
        /// <summary>
        /// Initialises a new instance of the <see cref="Program"/> class,
        /// </summary>
        static Program()
        {
            ReadConfigFile();

            bodies       = BodyGenerator.GenerateBodies(configuration.BodyCount, true);
            bodyShapeMap = BodyGenerator.GenerateShapes(bodies, BodyGenerator.DefaultRadiusDelegate, BodyGenerator.RainbowColourDelegate);

            UpdateDelegate bodyPositionUpdater = BodyUpdater.UpdateBodiesBarnesHut;

            ContextSettings customContextSettings = new ContextSettings {
                AntialiasingLevel = 8, DepthBits = 24, StencilBits = 8
            };

            RenderWindow simulationWindow =
                new RenderWindow(VideoMode.DesktopMode, "N-Body Simulation: FPS ", Styles.Default, customContextSettings);

            PrintContextSettings(customContextSettings);

            IInputHandler simulationInputHandler = new SimulationInputHandler(ref bodies);

            simulationScreen = new SimulationScreen(simulationWindow, simulationInputHandler, ref bodies, ref bodyShapeMap, bodyPositionUpdater)
            {
                Configuration = configuration,
            };
        }
示例#4
0
        public void Test_HelloWorld()
        {
            var classBuilder = new ClassBuilder("Program", "HelloWorld");
            var @class       = classBuilder
                               .WithUsings("System")
                               .WithModifiers(Modifiers.Public)
                               .WithMethods(
                new MethodBuilder("Main")
                .WithParameters(new Parameter("args", typeof(string[])))
                .WithBody(
                    BodyGenerator.Create(
                        Statement.Expression.Invoke("Console", "WriteLine", new List <IArgument>()
            {
                new ValueArgument("Hello world")
            }).AsStatement(),
                        Statement.Expression.Invoke("Console", "ReadLine").AsStatement()
                        ))
                .WithModifiers(Modifiers.Public, Modifiers.Static)
                .Build())
                               .Build();

            Assert.AreEqual(
                @"usingSystem;namespaceHelloWorld{publicclassProgram{publicstaticvoidMain(string[]args){Console.WriteLine(""Hello world"");Console.ReadLine();}}}",
                @class.ToString());
        }
示例#5
0
        /// <summary>
        /// Generate the class, fields and constructor for a page object
        /// </summary>
        /// <param name="pageObejctName">Name of the new page object</param>
        /// <param name="namespace">Name of the namespace to generate</param>
        /// <param name="uiObjects">UiObject inside the class</param>
        /// <param name="useAttributes">If we should generate ui objects as attributes</param>
        /// <returns>The generated code as a string</returns>
        public string GeneratePageObject(string pageObejctName, string @namespace, IEnumerable <UiObjectInfo> uiObjects, bool useAttributes)
        {
            var fields     = new List <Field>();
            var statements = new List <StatementSyntax>();

            fields.Add(new Field(DeviceName, typeof(IAndroidDevice), new[] { Modifiers.Private }));
            statements.Add(Statement.Declaration.Assign(new VariableReference("this", new MemberReference(DeviceName)), new VariableReference("device")));

            foreach (var pageObjectUiNode in uiObjects)
            {
                var generatedUiObject = GenerateUiObject(pageObjectUiNode, useAttributes);
                fields.Add(generatedUiObject.field);
                if (generatedUiObject.statement != null)
                {
                    statements.Add(generatedUiObject.statement);
                }
            }

            var classBuilder = new ClassBuilder(pageObejctName, @namespace)
                               .WithUsings("Testura.Android.Device", "Testura.Android.Device.Ui.Objects", "Testura.Android.Device.Ui.Search")
                               .WithFields(fields.ToArray())
                               .WithConstructor(ConstructorGenerator.Create(
                                                    pageObejctName,
                                                    BodyGenerator.Create(statements.ToArray()),
                                                    modifiers: new[] { Modifiers.Public },
                                                    parameters: new List <Parameter> {
                new Parameter("device", typeof(IAndroidDevice))
            }))
                               .Build();

            return(_codeSaver.SaveCodeAsString(classBuilder));
        }
        public Message Post([FromBody] string value)
        {
            var msg = new Message {
                Body = BodyGenerator.GetNext()
            };

            return(msg);
        }
 private MethodDeclarationSyntax GenerateSetUp(Type typeUnderTest, IEnumerable <Models.Parameter> parameters)
 {
     return((MethodDeclarationSyntax) new MethodBuilder("SetUp")
            .WithAttributes(new Attribute(SetUpAttribute))
            .WithModifiers(Modifiers.Public)
            .WithBody(BodyGenerator.Create(_mockGenerator.GenerateSetUpStatements(typeUnderTest, parameters).ToArray()))
            .Build());
 }
示例#8
0
        public void Build_WhenHavingOperatorOverloading_ShouldGenerateOverloading()
        {
            var builder = new MethodBuilder("MyMethod")
                          .WithModifiers(Modifiers.Public, Modifiers.Static)
                          .WithOperatorOverloading(Operators.Equal)
                          .WithBody(BodyGenerator.Create());

            StringAssert.Contains("publicstaticMyMethodoperator==(){}", builder.Build().ToString());
        }
示例#9
0
        public void GetArgumentSyntax_WhenCreatingWithWithBlock_ShouldGetCorrectCode()
        {
            var block = BodyGenerator.Create(Statement.Expression.Invoke("MyMethod").AsStatement());

            var argument = new LambdaArgument(block, "n");
            var syntax   = argument.GetArgumentSyntax();

            Assert.IsInstanceOf <ArgumentSyntax>(syntax);
            Assert.AreEqual("n=>{MyMethod();}", syntax.ToString());
        }
示例#10
0
 static bool Prefix(BodyGenerator __instance)
 {
     __instance.Character.UpdatePlayerCharacterBodyProperties(__instance.CurrentBodyProperties, __instance.IsFemale);
     if (__instance.Character is CharacterObject characterObject)
     {
         float bodyAge = __instance.CurrentBodyProperties.DynamicProperties.Age;
         characterObject.HeroObject.SetBirthDay(HeroHelper.GetRandomBirthDayForAge((int)bodyAge));
     }
     return(false);
 }
        public void GetArgumentSyntax_WhenCreatingWithWithBlock_ShouldGetCorrectCode()
        {
            var block = BodyGenerator.Create(Statement.Expression.Invoke("MyMethod").AsStatement());

            var argument = new ParenthesizedLambdaArgument(block, new[] { new Parameter("myPara", typeof(int)) });
            var syntax   = argument.GetArgumentSyntax();

            Assert.IsInstanceOf <ArgumentSyntax>(syntax);
            Assert.AreEqual("(myPara)=>{MyMethod();}", syntax.ToString());
        }
示例#12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MethodBuilder"/> class.
        /// </summary>
        /// <param name="name">Name of the method</param>
        public MethodBuilder(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(name));
            }

            _name       = name.Replace(" ", "_");
            _parameters = new List <ParameterSyntax>();
            _modifiers  = new List <Modifiers>();
            _body       = BodyGenerator.Create();
        }
 static void Postfix(BodyGenerator __instance)
 {
     if (__instance.Character is CharacterObject characterObject)
     {
         float bodyAge = __instance.CurrentBodyProperties.DynamicProperties.Age;
         CharacterBodyManager.ResetBirthDayForAge(characterObject, bodyAge);
         if (DCCSettingsUtil.Instance.DebugMode)
         {
             Debug.Print($"[CharacterCreation] Character {characterObject.Name} expected age: {bodyAge}, actual: {characterObject.Age}");
         }
     }
 }
        public JsonResult Calculate()
        {
            // Deserializing
            string json;

            using (var reader = new StreamReader(Request.InputStream))
            {
                json = reader.ReadToEnd();
            }
            var jsonObject = JsonConvert.DeserializeObject(json);

            // Generating
            var bodyGenerator = new BodyGenerator();
            var body          = bodyGenerator.GenerateBody(jsonObject);
            var id            = Guid.NewGuid();
            var calculator    = new BodyCalculator(id, body);
            var result        = calculator.GenerateBodyMasses();

            // Error calculation
            double? error     = null;
            decimal decError  = 0;
            bool    toCompare = false;

            if (body.Weight.HasValue)
            {
                error     = result.BodyMass.TotalMass - body.Weight;
                decError  = Math.Round(decimal.Divide((decimal)error, (decimal)body.Weight) * 100, 2);
                toCompare = true;
            }

            // Recording
            var user = User.Identity.IsAuthenticated ? User.Identity.GetUserName() : string.Empty;

            this.bodyRecorder.RecordBody(body, result, decError, toCompare, user, User.Identity.IsAuthenticated);

            // Send to clients
            var jsonResult = string.Empty;

            if ((toCompare && decError <= 5) || !toCompare)
            {
                // Serializing
                jsonResult = JsonConvert.SerializeObject(result.BodyMass);
            }
            else
            {
                // Error message
                jsonResult = "Error";
            }

            // Returning to client
            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
示例#15
0
 static bool Prefix(BodyGenerator __instance)
 {
     try
     {
         __instance.Character.UpdatePlayerCharacterBodyProperties(__instance.CurrentBodyProperties, __instance.IsFemale);
         return(false);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"{ErrorText.ToString()}\n{ex.Message} \n\n{ex.InnerException?.Message}");
         return(true);
     }
 }
 public void Constructor_WhenCreatingConstructorWithParamterAndModifierAndAttribute_ShouldGenerateCorrectCode()
 {
     Assert.AreEqual("[Test]publicMyClass(inti){}",
                     ConstructorGenerator.Create("MyClass", BodyGenerator.Create(),
                                                 new List <Parameter> {
         new Parameter("i", typeof(int))
     }, new List <Modifiers>()
     {
         Modifiers.Public
     },
                                                 new List <Attribute> {
         new Attribute("Test")
     }).ToString());
 }
示例#17
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());
        }
    // When it enters another collider
    void OnCollisionStay2D(Collision2D other)
    {
        BodyGenerator body = other.gameObject.GetComponent <BodyGenerator>();

        // If what you collided with has a bodygenerator, that means it's a body and that you should latch on to it
        // But only latch on to it if you're velocity is small enough
        if (body != null && rigidBody.velocity.sqrMagnitude <= MinimumLatchVelocitySqr)
        {
            this.body             = body;
            transform.parent      = body.gameObject.transform;
            rigidBody.isKinematic = true;
        }

        EntityOnCollisionStay2D(other);
    }
示例#19
0
 static bool Prefix(BodyGenerator __instance)
 {
     try
     {
         //TODO: Update to reflect SaveTraitChange() -- Does nothing right now but may in the future
         //var piSBP = typeof(BodyGenerator).GetProperty("SaveTraitChanges", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
         __instance.Character.UpdatePlayerCharacterBodyProperties(__instance.CurrentBodyProperties, __instance.IsFemale);
         return(false);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Error :\n{ex.Message} \n\n{ex.InnerException?.Message}");
         return(true);
     }
 }
示例#20
0
        public void Test_CreateClassWithMethodThatHaveOverrideOperators()
        {
            var classBuilder = new ClassBuilder("Cat", "Models");
            var @class       = classBuilder
                               .WithUsings("System")
                               .WithMethods(new MethodBuilder("MyMethod")
                                            .WithModifiers(Modifiers.Public, Modifiers.Static)
                                            .WithOperatorOverloading(Operators.Increment)
                                            .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{publicclassCat{publicstaticMyMethodoperator++(stringMyParameter){//hej\ninthello;inthello; //My comment to the side\n}}}",
                @class.ToString());
        }
        /// <summary>
        /// override base _buildPageDef but still call it first
        /// implement table here
        /// </summary>
        protected override void _buildPageDef()
        {
            // call base to build footer, loop, body, footer from xml
            base._buildPageDef();
            //Console.WriteLine("call _buildPageDef in PDFTemplateItextSharp");

            // here, we build the table from xml
            XmlElement elmRoot   = XMLTemplate.DocumentElement;
            XmlNode    tableNode = elmRoot.SelectSingleNode("//table");

            if (tableNode != null)
            {
                principalTableGenerator = new TableGenerator(this, tableNode);
            }

            XmlNode bodyNode = elmRoot.SelectSingleNode("//body");

            if (tableNode != null)
            {
                bodyGenerator = new BodyGenerator(this, bodyNode);
            }
        }
 static bool Prefix(BodyGenerator __instance)
 {
     try
     {
         __instance.Character.UpdatePlayerCharacterBodyProperties(__instance.CurrentBodyProperties, __instance.IsFemale);
         if (__instance.Character is CharacterObject characterObject)
         {
             float bodyAge = __instance.CurrentBodyProperties.DynamicProperties.Age;
             CharacterBodyManager.ResetBirthDayForAge(characterObject, __instance.CurrentBodyProperties.DynamicProperties.Age);
             if (DCCSettingsUtil.Instance.DebugMode)
             {
                 Debug.Print($"[CharacterCreation] Character {characterObject.Name} expected age: {bodyAge}, actual: {characterObject.Age}");
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"{ErrorText}\n{ex.Message} \n\n{ex.InnerException?.Message}");
         return(true);
     }
 }
示例#23
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 If_WhenCreatingAnComplexBinaryExpression_ShouldGenerateCorrectIfStatement()
        {
            var leftBinaryExpression = new ConditionalBinaryExpression(
                new ConstantReference(1),
                new ConstantReference(2),
                ConditionalStatements.Equal);

            var rightBinaryExpression = new ConditionalBinaryExpression(
                new ConstantReference(1),
                new ConstantReference(2),
                ConditionalStatements.LessThan);

            var orBinaryExpression = new OrBinaryExpression(
                leftBinaryExpression,
                rightBinaryExpression);

            var binaryExpression = new OrBinaryExpression(
                leftBinaryExpression,
                orBinaryExpression);

            Assert.AreEqual("if(1==2||1==2||1<2){}",
                            conditional.If(binaryExpression, BodyGenerator.Create()).ToString());
        }
示例#25
0
        public void Test_ArgumentNull()
        {
            var classBuilder = new ClassBuilder("NullTest", "MyTest");
            var @class       = classBuilder
                               .WithUsings("System", "NUnit.Framework")
                               .WithModifiers(Modifiers.Public)
                               .WithMethods(
                new MethodBuilder("SetUp")
                .WithAttributes(new Attribute("SetUp"))
                .WithModifiers(Modifiers.Public)
                .Build(),
                new MethodBuilder("Test_WhenAddingNumber_ShouldBeCorrectSum")
                .WithAttributes(new Attribute("Test"))
                .WithModifiers(Modifiers.Public)
                .WithBody(
                    BodyGenerator.Create(
                        Statement.Declaration.Declare("myList", typeof(List <int>)),
                        NunitAssertGenerator.Throws(new VariableReference("myList", new MethodReference("First")), typeof(ArgumentNullException))))
                .Build())
                               .Build();

            Assert.AreEqual(@"usingSystem;usingNUnit.Framework;namespaceMyTest{publicclassNullTest{[SetUp]publicvoidSetUp(){}[Test]publicvoidTest_WhenAddingNumber_ShouldBeCorrectSum(){List<int>myList;Assert.Throws<ArgumentNullException>(()=>myList.First(),"""");}}}", @class.ToString());
        }
示例#26
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());
        }
示例#27
0
        private IEnumerable <IArgument> GenerateAutoSelectedWiths(AutoSelectedWith autoSelected)
        {
            // If it's only one parent create a simple lambda expression without block
            if (autoSelected.Parent.Parent == null)
            {
                return(new List <IArgument>
                {
                    new LambdaArgument(
                        new AndBinaryExpression(
                            GetBinaryExpression(autoSelected.Parent, true, 1),
                            GetBinaryExpression(autoSelected, false, 0)).GetBinaryExpression(),
                        "n")
                });
            }

            var generatedIf = Statement.Selection.If(
                GetBinaryExpression(autoSelected, false, 0),
                BodyGenerator.Create(Statement.Jump.ReturnTrue()));

            return(new List <IArgument>
            {
                new LambdaArgument(BodyGenerator.Create(GenerateParantIfs(autoSelected.Parent, generatedIf, 1), Statement.Jump.ReturnFalse()), "n")
            });
        }
 public void If_WhenCreatingAnBinaryExpression_ShouldGenerateCorrectIfStatement()
 {
     Assert.AreEqual("if(2<=3){}",
                     conditional.If(new ConditionalBinaryExpression(new ConstantReference(2), new ConstantReference(3), ConditionalStatements.LessThanOrEqual), BodyGenerator.Create()).ToString());
 }
 public void If_WhenCreatingAnIfWithLessThanOrEqual_ShouldGenerateCorrectIfStatement()
 {
     Assert.AreEqual("if(2<=3){}",
                     conditional.If(new ValueArgument(2), new ValueArgument(3), ConditionalStatements.LessThanOrEqual, BodyGenerator.Create()).ToString());
 }
示例#30
0
 public void While_WhenCreatingWhileLoopWithTrue_ShouldGenerateCode()
 {
     Assert.AreEqual("while(true){}", _control.WhileTrue(BodyGenerator.Create()).ToString());
 }