public void AssignConstToField() { //-- Arrange var field1 = m_ClassBody.Field <int>("f1"); IHappilOperand <int> const1 = new HappilConstant <int>(123); //-- Act m_ClassBody.Method(cls => cls.VirtualVoidMethod).Implement(m => { field1.Assign(const1); }); m_Class.CreateType(); //-- Assert var method = m_Class.FindMember <HappilMethod>("VirtualVoidMethod"); Assert.That( method.ToString(), Is.EqualTo("{Expr<Int32>{Field{f1} = Const<Int32>{123}};}")); }
//----------------------------------------------------------------------------------------------------------------------------------------------------- public HappilForShortSyntax For(IHappilOperand <int> from, HappilConstant <int> to, int increment = 1) { return(new HappilForShortSyntax(m_OwnerMethod, from.CastTo <int>(), to, increment)); }