Beispiel #1
0
        public TestSubject(string repositoryAsString, IFormater formater = null)
        {
            this.formater = formater ?? NullFormater.Instance;

            repository = MockRepositoryFor(repositoryAsString);
            stringRepresentation = repositoryAsString;
        }
Beispiel #2
0
        public bool Process(List <Entry> entrys, IFormater jsonFormater)
        {
            foreach (var entry in entrys.Where(entry => entry.EntryType == Com.Alibaba.Otter.Canal.Protocol.EntryType.Rowdata))
            {
                Console.WriteLine(jsonFormater.Format(entry));
            }

            return(true);
        }
Beispiel #3
0
 public WPTest(IDisplayer displayer, IStorage storage, CancellationTokenSource tokenSource)
 {
     TokenSource             = tokenSource ?? new CancellationTokenSource();
     Displayer               = displayer;
     Storage                 = storage;
     Tester                  = new WebTester(TokenSource, null);
     Tester.PageTestedAsync += Tester_PageTestedAsync;
     Formater                = new TestResultFormater();
 }
Beispiel #4
0
 private static string GetDigitFeminineStatus(IFormater formater, int digit, int groupLevel)
 {
     if (groupLevel == 0)
     {
         if (formater.IsFeminine)
         {
             return(arabicFeminineOnes[digit]);// use feminine field
         }
         else
         {
             return(arabicOnes[digit]);
         }
     }
     else
     {
         return(arabicOnes[digit]);
     }
 }
Beispiel #5
0
        public static BuildScript New(IFormater formater, string name, IEnumerable<Target> targets)
        {
            XElement scriptRoot = new XElement("project",
                                                new XAttribute("name", Path.GetFileName(name)),

                                               	ImportsFor(targets),

                                                from t in targets
                                                select new	XElement("target", CollectDependencies(t, AttributesFor(t, formater))));

            AddDefaultTargetIfOneExists(scriptRoot, targets);

            Stream output = new MemoryStream();
            using(var xmlWriter = XmlWriter.Create(output, new XmlWriterSettings { OmitXmlDeclaration =  true, Indent = true}))
            {
                scriptRoot.WriteTo(xmlWriter);
            }
            output.Position = 0;

            return new BuildScript(name, output);
        }
Beispiel #6
0
 public FileOutput(string filePath, IFormater iFormater)
 {
     MsgFormater  = iFormater;
     sw           = new StreamWriter(filePath);
     sw.AutoFlush = true;
 }
Beispiel #7
0
 public Appenders(IFormater formatter)
 {
     this.Formatter = formatter;
 }
 public AbilityEditToolbarViewModel(IFormater formater)
 {
     Formater = formater;
 }
Beispiel #9
0
 public Appenders(IFormater formatter)
 {
     this.Formatter = formatter;
 }
Beispiel #10
0
 public properbook(IFormater formatter)
     : base(formatter)
 {
 }
Beispiel #11
0
        private static XAttribute DependsAttribute(Target t, IFormater formater)
        {
            var referencedByDependsAttr = t.Dependencies.Where(IsExplicitDepencency).Select( d => d.StartsWith("*") ? d.Substring(1) :d );
            if (referencedByDependsAttr.Count() == 0) return null;

            return new XAttribute("depends", string.Join(",", referencedByDependsAttr.Select(d => TargetNameFromFullQualifiedDependency(d)).Select( n => formater.FormatTargetName(n))) );
        }
Beispiel #12
0
 public properFAQ(IFormater formatter) : base(formatter)
 {
 }
Beispiel #13
0
        public static string ToArabic(long number, IFormater formater, string ArabicPrefixText, string ArabicSuffixText)
        {
            Decimal tempNumber = number;

            if (tempNumber == 0)
            {
                return("صفر");
            }

            string retVal = String.Empty;
            Byte   group  = 0;

            while (tempNumber >= 1)
            {
                // seperate number into groups
                int numberToProcess = (int)(tempNumber % 1000);

                tempNumber = tempNumber / 1000;

                // convert group into its text
                string groupDescription = ProcessArabicGroup(formater, number, numberToProcess, group, Math.Floor(tempNumber));

                if (groupDescription != String.Empty)
                { // here we add the new converted group to the previous concatenated text
                    if (group > 0)
                    {
                        if (retVal != String.Empty)
                        {
                            retVal = String.Format("{0} {1}", "و", retVal);
                        }

                        if (numberToProcess != 2)
                        {
                            if (numberToProcess % 100 != 1)
                            {
                                if (numberToProcess >= 3 && numberToProcess <= 10) // for numbers between 3 and 9 we use plural name
                                {
                                    retVal = String.Format("{0} {1}", arabicPluralGroups[group], retVal);
                                }
                                else
                                {
                                    if (retVal != String.Empty) // use appending case
                                    {
                                        retVal = String.Format("{0} {1}", arabicAppendedGroup[group], retVal);
                                    }
                                    else
                                    {
                                        retVal = String.Format("{0} {1}", arabicGroup[group], retVal); // use normal case
                                    }
                                }
                            }
                            else
                            {
                                retVal = String.Format("{0} {1}", arabicGroup[group], retVal); // use normal case
                            }
                        }
                    }

                    retVal = String.Format("{0} {1}", groupDescription, retVal);
                }

                group++;
            }

            String formattedNumber = String.Empty;

            formattedNumber += (ArabicPrefixText != String.Empty) ? String.Format("{0} ", ArabicPrefixText) : String.Empty;
            formattedNumber += (retVal != String.Empty) ? retVal : String.Empty;
            if (number != 0)
            { // here we add currency name depending on _intergerValue : 1 ,2 , 3--->10 , 11--->99
                int remaining100 = (int)(number % 100);

                if (remaining100 == 0)
                {
                    formattedNumber += formater.Arabic1Name;
                }
                else
                if (remaining100 == 1)
                {
                    formattedNumber += formater.Arabic1Name;
                }
                else
                if (remaining100 == 2)
                {
                    if (number == 2)
                    {
                        formattedNumber += formater.Arabic2Name;
                    }
                    else
                    {
                        formattedNumber += formater.Arabic1Name;
                    }
                }
                else
                if (remaining100 >= 3 && remaining100 <= 10)
                {
                    formattedNumber += formater.Arabic310Name;
                }
                else
                if (remaining100 >= 11 && remaining100 <= 99)
                {
                    formattedNumber += formater.Arabic1199Name;
                }
            }

            formattedNumber += (ArabicSuffixText != String.Empty) ? String.Format(" {0}", ArabicSuffixText) : String.Empty;

            return(formattedNumber);
        }
Beispiel #14
0
 public Faq(IFormater formater) : base(formater)
 {
 }
Beispiel #15
0
        private static string ProcessArabicGroup(IFormater formater, long number, int groupNumber, int groupLevel, Decimal remainingNumber)
        {
            int tens = groupNumber % 100;

            int hundreds = groupNumber / 100;

            string retVal = String.Empty;

            if (hundreds > 0)
            {
                if (tens == 0 && hundreds == 2) // حالة المضاف
                {
                    retVal = String.Format("{0}", arabicAppendedTwos[0]);
                }
                else //  الحالة العادية
                {
                    retVal = String.Format("{0}", arabicHundreds[hundreds]);
                }
            }

            if (tens > 0)
            {
                if (tens < 20)
                {     // if we are processing under 20 numbers
                    if (tens == 2 && hundreds == 0 && groupLevel > 0)
                    { // This is special case for number 2 when it comes alone in the group
                        if (number == 2000 || number == 2000000 || number == 2000000000 || number == 2000000000000 || number == 2000000000000000 || number == 2000000000000000000)
                        {
                            retVal = String.Format("{0}", arabicAppendedTwos[groupLevel]); // في حالة الاضافة
                        }
                        else
                        {
                            retVal = String.Format("{0}", arabicTwos[groupLevel]);//  في حالة الافراد
                        }
                    }
                    else
                    { // General case
                        if (retVal != String.Empty)
                        {
                            retVal += " و ";
                        }

                        if (tens == 1 && groupLevel > 0 && hundreds == 0)
                        {
                            retVal += " ";
                        }
                        else
                        if ((tens == 1 || tens == 2) && (groupLevel == 0 || groupLevel == -1) && hundreds == 0 && remainingNumber == 0)
                        {
                            retVal += String.Empty;     // Special case for 1 and 2 numbers like: ليرة سورية و ليرتان سوريتان
                        }
                        else
                        {
                            retVal += GetDigitFeminineStatus(formater, tens, groupLevel);   // Get Feminine status for this digit
                        }
                    }
                }
                else
                {
                    int ones = tens % 10;
                    tens = (tens / 10) - 2; // 20's offset

                    if (ones > 0)
                    {
                        if (retVal != String.Empty)
                        {
                            retVal += " و ";
                        }

                        // Get Feminine status for this digit
                        retVal += GetDigitFeminineStatus(formater, ones, groupLevel);
                    }

                    if (retVal != String.Empty)
                    {
                        retVal += " و ";
                    }

                    // Get Tens text
                    retVal += arabicTens[tens];
                }
            }

            return(retVal);
        }
Beispiel #16
0
 public static string ToArabic(long number, IFormater formater)
 {
     return(ToArabic(number, formater, "", ""));
 }
Beispiel #17
0
 public Menuscript(IFormater formatter)
 {
     this.formatter = formatter;
 }
Beispiel #18
0
 public properTermPaper(IFormater formatter) : base(formatter)
 {
 }
Beispiel #19
0
 public Manuscript(IFormater _formatter)
 {
     formatter = _formatter;
 }
Beispiel #20
0
 public FrenchMenu(IFormater formatter) : base(formatter)
 {
 }
Beispiel #21
0
 public properTermPaper(IFormater formatter)
     : base(formatter)
 {
 }
Beispiel #22
0
        private static List<XObject> AttributesFor(Target target, IFormater formater)
        {
            List<XObject> attributes = new List<XObject>();

            attributes.Add(new XAttribute("name", target.Name));

            var dependencies = DependsAttribute(target, formater);
            if (dependencies != null)
            {
                attributes.Add(dependencies);
            }

            return attributes;
        }
 public EnglishMenu(IFormater formatter) : base(formatter)
 {
 }
Beispiel #24
0
 public FileAppender(string path,IFormater formater)
     : base(formater)
 {
     this.Formatter = formater;
     this.Path = path;
 }
Beispiel #25
0
 public properbook(IFormater formatter) : base(formatter)
 {
 }
Beispiel #26
0
 public ConsoleAppender(IFormater formatter) : base(formatter)
 {
 }
Beispiel #27
0
 public properFAQ(IFormater formatter)
     : base(formatter)
 {
 }
Beispiel #28
0
 public TermPaper(IFormater formater) : base(formater)
 {
 }
Beispiel #29
0
 public FileAppender(string path, IFormater formater) : base(formater)
 {
     this.Formatter = formater;
     this.Path      = path;
 }
 public Printer(IFormater formater)
 {
     this.formater = formater;
 }
Beispiel #31
0
 public ConsoleOutput(IFormater iFormater)
 {
     MsgFormater = iFormater;
 }
Beispiel #32
0
 public UnityOutput()
 {
     MsgFormater = new CommonMsgFormater();
 }
Beispiel #33
0
 public Book(IFormater formater) : base(formater)
 {
 }
 public BookListService(IFormater formater)
 {
     Formater = formater;
     Books =Formater.GetAll();
 }
Beispiel #35
0
 public Manuscript(IFormater _formatter)
 {
     formatter = _formatter;
 }