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()));
        }
Example #2
0
        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);
        }
Example #3
0
        /// <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);
        }
Example #4
0
        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();
        }
Example #6
0
 internal protected virtual T Visit(ConvertToString node)
 {
     return(Visit(node as Expression));
 }
Example #7
0
 public IHasMap <TClass> ConvertUsing(ConvertToString <TClass> convertExpression)
 {
     memberMap.Convert(convertExpression);
     return(this);
 }
Example #8
0
 protected override EP_VP1 Visit(ConvertToString node)
 {
     return(Visit(node as Expression));
 }
Example #9
0
 private static void Register(Type type, ConvertFromString fromstring, ConvertToString tostring)
 {
     stringtovalue[type] = fromstring;
     valuetostring[type] = tostring;
 }