public void Variable_T_ShouldRegisterExpression() { var comp = new SubExpressionCompiler <Action>(); comp.Variable <int>("i"); Assert.Equal(0, comp.ContentCount); Assert.Equal(1, comp.VariablesCount); Assert.Equal(0, comp.ParametersCount); Assert.Equal(1, comp.ExpressionsCount); }
public void CastOrUnbox_ShouldRegisterExpression() { var comp = new SubExpressionCompiler <Func <Obj> >(); var objVar = comp.Variable <Obj>("obj"); var newObj = comp.CastOrUnbox(objVar, typeof(object)); Assert.Equal(0, comp.ContentCount); Assert.Equal(1, comp.VariablesCount); Assert.Equal(0, comp.ParametersCount); Assert.Equal(2, comp.ExpressionsCount); }
public void Convert_T_ShouldRegisterExpression() { var comp = new SubExpressionCompiler <Func <Obj> >(); var objVar = comp.Variable <Obj>("obj"); var newObj = comp.Convert <object>(objVar); Assert.Equal(0, comp.ContentCount); Assert.Equal(1, comp.VariablesCount); Assert.Equal(0, comp.ParametersCount); Assert.Equal(2, comp.ExpressionsCount); }
public void EmitCall_ShouldRegisterContent() { var comp = new SubExpressionCompiler <Func <Obj> >(); var methodMi = typeof(Obj).GetMethod("Method"); var objVar = comp.Variable <Obj>("obj"); comp.EmitCall(methodMi, objVar); Assert.Equal(1, comp.ContentCount); Assert.Equal(1, comp.VariablesCount); Assert.Equal(0, comp.ParametersCount); Assert.Equal(1, comp.ExpressionsCount); }
public void EmitAssign_ShouldRegisterContent() { var comp = new SubExpressionCompiler <Func <Obj> >(); var objVar = comp.Variable <Obj>("obj"); var newObj = comp.New <Obj>(); comp.EmitAssign(objVar, newObj); Assert.Equal(1, comp.ContentCount); Assert.Equal(1, comp.VariablesCount); Assert.Equal(0, comp.ParametersCount); Assert.Equal(2, comp.ExpressionsCount); }
public void Property_ShouldRegisterExpression() { var comp = new SubExpressionCompiler <Action>(); var lengthPi = typeof(string).GetProperty("Length"); var str = comp.Variable <string>("str"); var strLength = comp.Property(str, lengthPi); Assert.Equal(0, comp.ContentCount); Assert.Equal(1, comp.VariablesCount); Assert.Equal(0, comp.ParametersCount); Assert.Equal(2, comp.ExpressionsCount); }
public void Field_ShouldRegisterExpression() { var comp = new SubExpressionCompiler <Action>(); var fieldFi = typeof(Obj).GetField("Field"); var objVar = comp.Variable <Obj>("obj"); var field = comp.Field(objVar, fieldFi); Assert.Equal(0, comp.ContentCount); Assert.Equal(1, comp.VariablesCount); Assert.Equal(0, comp.ParametersCount); Assert.Equal(2, comp.ExpressionsCount); }