public static void Initialise() { // try catch to be seted int number = 0; number = GetNumber.GetN(); //object contains symbols and arrays for structure Storage figures = new Storage(number); FirstEngine.FirstModule(number, figures.Star, figures.Minus, figures.GetFigures()); SecondEngine.SecondModule(number, figures.Star, figures.Minus, figures.GetFigures()); // thirdModule is reversed second one: SecondEngine.SecondModule(number, figures.Star, figures.Minus, figures.GetTemp()); ReverseArray.ReverseArrayEng(figures.GetFigures(), figures.GetTemp()); //fourthModule is the second one reusing code: SecondEngine.SecondModule(number, figures.Star, figures.Minus, figures.GetFigures()); //fifthModule is the first one reversed reusing code: FirstEngine.FirstModule(number, figures.Minus, figures.Star, figures.GetTemp()); ReverseArray.ReverseArrayEng(figures.GetFigures(), figures.GetTemp()); Display.Print(ConvertToString.ConvertStr(figures.GetFigures())); }
public void HappyPath(StringTestCase testCase) { var test = new ConvertToString(); var result = test.ChooseConversion(testCase.InputDate, testCase.InputBool, testCase.InputInt, testCase.InputDouble, testCase.InputMoney); Assert.AreEqual(testCase.ExpectedStringOutput, result, testCase.TestCaseName); }
/// <summary> /// Specifies an expression to be used to convert the object /// to a field. /// </summary> /// <param name="convertToStringFunction">The convert expression.</param> public virtual MemberMap <TClass, TMember> Convert(ConvertToString <TClass> convertToStringFunction) { var fieldParameter = Expression.Parameter(typeof(ConvertToStringArgs <TClass>), "args"); var methodExpression = Expression.Call( Expression.Constant(convertToStringFunction.Target), convertToStringFunction.Method, fieldParameter ); var lambdaExpression = Expression.Lambda <ConvertToString <TClass> >(methodExpression, fieldParameter); Data.WritingConvertExpression = lambdaExpression; return(this); }
public override String ToString() { ConvertToString converter = new ConvertToString(); try { Traverse(converter); } catch (Exception ex) { // Just in case converter.ReportError(ex); } return(converter.ToString()); }
static void Main(string[] args) { /// The two correct ways for make instance of delegate ConvertToString methodUsingDelegate1 = new ConvertToString(HelloDelegate); ConvertToString methodUsingDelegate = HelloDelegate; /// There is a mistake becouse the methed HelloDelegateWithString has a wrong signature (expected is string, actual is int) //ConvertToString methodUsingDelegate1 = new ConvertToString(HelloDelegateWithString); ConvertToInt methodUsingDelegateSecond = new ConvertToInt(HelloDelegateWithString); Console.WriteLine(methodUsingDelegate(152)); Console.WriteLine(methodUsingDelegate1(152)); Console.WriteLine(methodUsingDelegateSecond("sto")); Console.ReadKey(); }
internal protected virtual T Visit(ConvertToString node) { return(Visit(node as Expression)); }
public IHasMap <TClass> ConvertUsing(ConvertToString <TClass> convertExpression) { memberMap.Convert(convertExpression); return(this); }
protected override EP_VP1 Visit(ConvertToString node) { return(Visit(node as Expression)); }
private static void Register(Type type, ConvertFromString fromstring, ConvertToString tostring) { stringtovalue[type] = fromstring; valuetostring[type] = tostring; }