Exemplo n.º 1
0
        public async Task <decimal> GetTaxForOrder(OrderVM order)
        {
            if (string.IsNullOrEmpty(order.ToCountry) || order.Shipping < 0)
            {
                throw new InvalidOperationException("ZipCode is a required data");
            }

            if (!string.IsNullOrEmpty(order.ToCountry))
            {
                if (!RegEx.IsValidCountry(order.ToCountry.ToUpper()))
                {
                    throw new InvalidOperationException("Destination country is not a valid Code");
                }

                if (order.ToCountry.ToLower() == "us" && string.IsNullOrEmpty(order.ToZip))
                {
                    throw new InvalidOperationException("ZipCode data is required when destination country is US");
                }

                if (order.ToCountry.ToLower() == "us" && !RegEx.isValidZipCode(order.ToZip))
                {
                    throw new InvalidOperationException("ZipCode data is not a valid US ZipCode");
                }

                if ((order.ToCountry.ToLower() == "us" || order.ToCountry.ToLower() == "ca") && string.IsNullOrEmpty(order.ToState))
                {
                    throw new InvalidOperationException("Destination state is required whe Destination country is US or CA");
                }
            }

            var orderApi = _mapper.Map <Order>(order);
            var response = await _taxJarClient.TaxForOrderAsync(orderApi);

            return(response.AmountToCollect);
        }
 public void loadListOfGacAssemblies(TreeView lbListOfGacAssemblies, string filter, List <IGacDll> assembliesToLoad)
 {
     this.invokeOnThread(
         () =>
     {
         tvListOfGacAssemblies.Nodes.Clear();
         foreach (var gacAssembly in assembliesToLoad)
         {
             if (RegEx.findStringInString(gacAssembly.name, filter))
             {
                 var newTreeNode = new TreeNode(gacAssembly.name)
                 {
                     Tag = gacAssembly
                 };
                 if (treeViewColorFilter != null && filter != "")
                 {
                     // for performance reasons only apply this when there is a filter
                     if (treeViewColorFilter(gacAssembly.fullPath))
                     {
                         // move this code to the consumers of this assembly
                         /* if (PostSharpUtils.containsO2PostSharpHooks(gacAssembly.fullPath))*/
                         newTreeNode.ForeColor = Color.DarkGreen;
                     }
                     else
                     {
                         newTreeNode.ForeColor = Color.DarkRed;
                     }
                 }
                 tvListOfGacAssemblies.Nodes.Add(newTreeNode);
             }
         }
     });
 }
        private void SubmitButton()
        {
            Common cmnObj = new Common();
            RegEx  regObj = new RegEx();

            if (LoginModel.textBoxEmail.Length == 0)
            {
                LoginModel.errormessage = GenericError.strEmptyEmail;
            }
            else if (!Regex.IsMatch(LoginModel.textBoxEmail, regObj.strRegEmail))
            {
                LoginModel.errormessage = GenericError.strValidEmail;
            }
            else
            {
                var datatable = GenericEmpOp.Login(LoginModel.textBoxEmail, LoginModel.passwordBox1);
                if (datatable != null)
                {
                    string username = datatable.Rows[0][1].ToString();
                    string userType = datatable.Rows[0][6].ToString();
                    if (userType == "A")
                    {
                    }
                    Welcome welcomeCls = new Welcome();
                    welcomeCls.Show();
                }
                else
                {
                    LoginModel.errormessage = GenericError.strInvalidUserPassword;
                }
            }
        }
Exemplo n.º 4
0
                public static string Interpolation(string original, object obj)
                {
                    const string openToken  = "{";
                    const string closeToken = "}";

                    var properties = TypeDescriptor
                                     .GetProperties(obj)
                                     .Cast <PropertyDescriptor>()
                                     .ToArray();

                    var builder = new StringBuilder(original);

                    Enumerable.ForEach(
                        RegEx.Matches(openToken, closeToken, original),
                        info =>
                    {
                        var prop = properties.FirstOrDefault(descriptor => descriptor.Name == info.Content);
                        if (prop == null)
                        {
                            return;
                        }

                        builder.Replace(info.Expression, prop.GetValue(obj)?.ToString() ?? string.Empty);
                    });

                    return(builder.ToString());
                }
Exemplo n.º 5
0
        public override string CreateAssemblyName()
        {
            string fileName = Path.ChangeExtension(Key, null);

            fileName = RegEx.Replace(fileName, string.Empty);
            return($"tk_{fileName}_{File.LastWriteTime.Ticks}");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Handler to interpret and execute commands entered in the console
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="CommandEvent"></param>
        private void ConsoleCommandHandler(object Sender, string CommandEvent)
        {
            if (RegEx.LooseTest(CommandEvent, @"^\s*(quit|exit|close)\s*$") == true)
            {
                Exit();
            }
            else if (RegEx.QuickTest(CommandEvent, @"linewidth\s*=\s*[0-9]+") == true)
            {
                int    nNewWidth, nCtr;
                string Param = RegEx.GetRegExGroup(CommandEvent, @"linewidth\s*=\s*([0-9]+)", 1);

                if (int.TryParse(Param, out nNewWidth) == false)
                {
                    cDevConsole.AddText(String.Format("Invalid parameter '{0}' in command 'LINEWIDTH'", Param));
                }
                else if (nNewWidth <= 0)
                {
                    cDevConsole.AddText(String.Format("Invalid parameter '{0}' in command 'LINEWIDTH'", Param));
                }
                else
                {
                    cDevConsole.AddText(String.Format("Polygon line width set to {0}", nNewWidth));

                    for (nCtr = 0; nCtr < cPolyList.Count; nCtr++)
                    {
                        cPolyList[nCtr].LineWidth = nNewWidth;
                    }
                }
            }
            else
            {
                cDevConsole.AddText("Unrecognized command: " + CommandEvent);
            }
        }
        public bool canLoadFile(string fileToTryToLoad)
        {
            var    expectedRootElementRegEx = "<AssessmentRun.*name.*version=\"6.0";  // note this engine probably supports older files
            string rootElementText          = XmlHelpers.getRootElementText(fileToTryToLoad);

            if (RegEx.findStringInString(rootElementText, expectedRootElementRegEx))
            {
                "Engine {0} can load file {1}".info(engineName, fileToTryToLoad);
                return(true);
            }

            var expectedRootElementText    = "<AssessmentRun";
            var notExpectedRootElementText = "version";

            if (rootElementText.contains(expectedRootElementText) && !rootElementText.contains(notExpectedRootElementText))
            //rootElementText.IndexOf(expectedRootElementText) > -1 && rootElementText.IndexOf(notExpectedRootElementText)== -1)
            {
                "Engine {0} can load file {1}".info(engineName, fileToTryToLoad);
                return(true);
            }

            //"in {0} engine, could not load file {1} since the root element value didnt match: {2}!={3}".error(
            //             engineName, fileToTryToLoad, rootElementText ,expectedRootElementText);
            return(false);
        }
        // Helper method that assigns name, email and phone of our person
        // Get's called as part of Create() in our teacher/student repositories
        protected Person AssignPersonProperties(Person user)
        {
            Console.Clear();

            Console.WriteLine("Please input user's name:");
            user.Name = Console.ReadLine();

            Console.WriteLine("Please input user's phone number:");
            string phoneNumber = Console.ReadLine();

            // Using regular expressions to check for valid phone numbers
            while (!RegEx.CheckPhone(phoneNumber))
            {
                Console.WriteLine("Phone number is invalid, please input correct phone number: (XXX XXX XXXX)");
                phoneNumber = Console.ReadLine();
            }
            user.Phone = phoneNumber;

            Console.WriteLine("Please input user's email:");
            string email = Console.ReadLine();

            // Using regular expressions to check for valid emails
            while (!RegEx.CheckEmail(email))
            {
                Console.WriteLine("Email syntax is invalid, please input correct email:");
                email = Console.ReadLine();
            }
            user.Email = email;

            return(user);
        }
Exemplo n.º 9
0
 private IRegExNode <char> ParseLiteral()
 {
     if (this.Match('\\'))
     {
         var ch = this.Consume();
         if (IsSpecial(ch))
         {
             return(RegEx.Lit(ch));
         }
         var escaped = Escape(ch);
         if (escaped == null)
         {
             throw new FormatException($"invalid escape \\{ch} (position {this.index - 2})");
         }
         return(RegEx.Lit(escaped.Value));
     }
     else
     {
         var ch = this.Consume();
         if (IsSpecial(ch))
         {
             throw new FormatException($"special character {ch} must be escaped (position {this.index - 1})");
         }
         return(RegEx.Lit(ch));
     }
 }
Exemplo n.º 10
0
        public static void insertHashToFiles()
        {
            FTDataSet ds = new FTDataSet();
            FilesforUpdateNameTableAdapter files = new FilesforUpdateNameTableAdapter();
            files.Fill(ds.FilesforUpdateName);
            try
            {
                foreach (DataRow dr in ds.FilesforUpdateName.Rows)
                {
                    MATCFileNameFullExtensoinResult match = RegEx.GetMATCFileNameFullExtensoinResult(dr["name"].ToString()).FirstOrDefault();
                    string _result = null;
                    if (match != null)
                    {
                        _result = match.UNOM + match.Name + match.Date + "_" + dr["Hash"].ToString() + "." + match.Extension;
                        if (dr["name"].ToString() != _result)
                        { dr["name"] = _result; }
                    }
                };
            }
            finally
            {
                if (ds.FilesforUpdateName.HasErrors)
                { }
                else // If no errors, AcceptChanges.

                        if (ds.FilesforUpdateName.GetChanges() != null)
                {
                    files.Update(ds.FilesforUpdateName);
                }
            }
        }
Exemplo n.º 11
0
        public async Task <decimal> GetTaxRateForLocation(AddressVM address)
        {
            if (string.IsNullOrEmpty(address.Zip))
            {
                throw new InvalidOperationException("ZipCode is a required data");
            }

            if (!string.IsNullOrEmpty(address.Country))
            {
                if (!RegEx.IsValidCountry(address.Country.ToUpper()))
                {
                    throw new InvalidOperationException("Country code is not a valid value.");
                }
            }

            if (!RegEx.isValidZipCode(address.Zip))
            {
                throw new InvalidOperationException("ZipCode data is not a valid US ZipCode.");
            }

            var addressApi = _mapper.Map <Address>(address);
            var response   = await this._taxJarClient.RatesForLocationAsync(addressApi.Zip, addressApi);

            return(response.CombinedRate);
        }
Exemplo n.º 12
0
        public static void ActFiles_normalizationName()
        {
            MATCFileNameFull q = new MATCFileNameFull();
            FTDataSet ds = new FTDataSet();
            CommonTableAdapter cta = new CommonTableAdapter();
            ActFilesforUpdateNameTableAdapter f4 = new ActFilesforUpdateNameTableAdapter();
            f4.Fill(ds.ActFilesforUpdateName);
            try
            {
                /*var rr = ds.ActFilesforUpdateName.Where(selector =>
                {
                    MATCFileNameFullExtensoinResult match1 = RegEx.GetMATCFileNameFullExtensoinResult(selector["name"].ToString()).FirstOrDefault();
                    if (match1 != null && string.IsNullOrEmpty(match1.Name)) { return true; } else { return false; };
                }).ToList();*/
                foreach (DataRow dr in ds.ActFilesforUpdateName.Rows)
                {
                    string _result = null;
                    MATCFileNameFullExtensoinResult match = RegEx.GetMATCFileNameFullExtensoinResult(dr["name"].ToString().Trim()).FirstOrDefault();
                    if (match != null)
                    {
                        Console.WriteLine(dr["name"].ToString() + " добавляется");
                        if (string.IsNullOrEmpty(match.Name))
                        { _result = match.UNOM + "_фото_" + dr["fdate"].ToString() + "_" + dr["Hash"].ToString() + "." + match.Extension; }
                        else
                        { _result = match.UNOM + match.Name + "_" + dr["fdate"].ToString() + "_" + dr["Hash"].ToString() + "." + match.Extension; }
                        if (dr["Name"].ToString() != _result)
                        {
                            //dr.SetField<string>("Name", _result);
                            try
                            {
                                cta.Update_ActFiles_names_Query(_result, dr["path_locator"].ToString());
                                Console.WriteLine(_result);
                            }
                            catch (Exception e)
                            { Console.WriteLine(_result + e.Message); }
                        };
                    }
                    else
                    {
                        _result = dr["UNOM"].ToString() + "_фото_" + dr["fdate"].ToString() + "_" + dr["Hash"].ToString() + "." + dr["file_type"].ToString();
                        Console.WriteLine(dr["name"].ToString() + " добавляется");
                        cta.Update_ActFiles_names_Query(_result, dr["path_locator"].ToString());
                    };
                }
            }
            finally
            {
                if (ds.ActFilesforUpdateName.HasErrors)
                {
                }
                else
                    // If no errors, AcceptChanges.
                    if (ds.ActFilesforUpdateName.GetChanges() != null)
                {
                    //ds.Files4forUpdateName.AcceptChanges();
                    f4.Update(ds.ActFilesforUpdateName);
                }

            }
        }
Exemplo n.º 13
0
    private Array <Dictionary <string, Color> > ParseFile()
    {
        var output = new Array <Dictionary <string, Color> >();

        var file = new File();

        file.Open(FileName, File.ModeFlags.Read);

        while (!file.EofReached())
        {
            var line      = file.GetLine();
            var colorName = line.Split(" ")[0];
            var regex     = new RegEx();
            regex.Compile("\\( .* \\)");
            var result          = regex.Search(line);
            var colorStr        = result.Strings[0] as string;
            var cleanedColorStr = colorStr.Replace("(", "").Replace(")", "").Replace(" ", "");
            var splitted        = cleanedColorStr.Split(",");

            var dic = new Dictionary <string, Color>
            {
                [colorName] = new Color(
                    float.Parse(splitted[0]),
                    float.Parse(splitted[1]),
                    float.Parse(splitted[2]),
                    float.Parse(splitted[3])
                    )
            };

            output.Add(dic);
        }

        return(output);
    }
Exemplo n.º 14
0
 static Converter()
 {
     // initialize the list of GLSL data types
     InvalidVariableNames = new[] { "return", "discard", "continue" };
     DebugFunctions       = new[] { "texture", "texelFetch" };
     DebugFuncRegex       = DebugFunctions.Select(x => RegEx.FuncCall(x)).ToArray();
 }
Exemplo n.º 15
0
 public Console()
 {
     _rootGroup = new CommandGroup("root");
     // Used to clear text from bb tags
     _eraseTrash = new RegEx();
     _eraseTrash.Compile("\\[[\\/]?[a-z0-9\\=\\#\\ \\_\\-\\,\\.\\;]+\\]");
 }
Exemplo n.º 16
0
        /// <summary>
        /// Handler to interpret and execute commands entered in the console
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="CommandEvent"></param>
        private void ConsoleCommandHandler(object Sender, string CommandEvent)
        {
            int       nCtr;
            string    strParam;
            Texture2D Txtr;
            Rectangle rectRegion;

            if (RegEx.LooseTest(CommandEvent, @"^\s*(quit|exit|close)\s*$") == true)
            {
                Exit();
            }
            else if (RegEx.LooseTest(CommandEvent, @"edit\s*vertexes=(on|1|off|0)") == true)
            {
                if (RegEx.LooseTest(CommandEvent, @"edit\s*vertexes=(on|1)") == true)
                {
                    cObjManager[0][0].AllowCollisionVertexEdits = true;
                }
                else
                {
                    cObjManager[0][0].AllowCollisionVertexEdits = false;
                }
            }
            else if (RegEx.LooseTest(CommandEvent, @"list\s*vertexes") == true)
            {
                List <Vector2> VertList = new List <Vector2>(cObjManager[0][0].GetCollisionVertexes());
                nCtr = 0;
                foreach (Vector2 vVert in VertList)
                {
                    cDevConsole.AddText(String.Format("{0}:X{1} Y{2}", nCtr, vVert.X, vVert.Y));
                    nCtr += 1;
                }
            }
            else if (RegEx.LooseTest(CommandEvent, @"set\s*texture\s*=(.*)") == true)
            {
                strParam = RegEx.GetRegExGroup(CommandEvent, @"set\s*texture\s*=(.*)", 1);

                if (cTextureAtlas.ContainsImage(strParam) == false)
                {
                    cDevConsole.AddText(String.Format("No tile exists named '{0}'", strParam));
                    return;
                }

                cTextureAtlas.GetTileInfo(strParam, out Txtr, out rectRegion);
                cObjManager[0][0].TextureName = strParam;
                cObjManager[0][0].Scale       = new Vector2(1, 1);
                cObjManager[0][0].Width       = rectRegion.Width;
                cObjManager[0][0].Height      = rectRegion.Height;

                cDevConsole.AddText(String.Format("Tile is H{0} x W{1}", rectRegion.Height, rectRegion.Width));
            }
            else if (RegEx.LooseTest(CommandEvent, @"(bullet|missile)\s*count") == true)
            {
                cDevConsole.AddText(String.Format("Misile count: {0}", cObjManager[(int)eObjGroups_t.PlayerBullets].Count));
            }
            else
            {
                cDevConsole.AddText("Unrecognized command: " + CommandEvent);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Handler to interpret and execute commands entered in the console
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="CommandEvent"></param>
        private void ConsoleCommandHandler(object Sender, string CommandEvent)
        {
            if (RegEx.LooseTest(CommandEvent, @"^\s*(quit|exit|close)\s*$") == true)
            {
                Exit();
            }
            else if (RegEx.LooseTest(CommandEvent, @"^add\s*([0-9]+)\s*([^ ]+)$") == true)
            {
                string       strPart;
                bool         bParse;
                UInt32       nCtr, nNumParticles;
                TextureFiles eTexture;
                Particle2D   NewParticle;

                strPart       = RegEx.GetRegExGroup(CommandEvent, @"^add\s*([0-9]+)\s*([^ ]+)$", 1);
                nNumParticles = UInt32.Parse(strPart);

                strPart = RegEx.GetRegExGroup(CommandEvent, @"^add\s*([0-9]+)\s*([^ ]+)$", 2);
                bParse  = Enum.TryParse <TextureFiles>(strPart, true, out eTexture);
                if (bParse == false)
                {
                    cDevConsole.AddText(String.Format("No texture named '{0}' could be found", strPart));
                    return;
                }

                //Randomly generate the number of particles requested
                for (nCtr = 0; nCtr < nNumParticles; nCtr++)
                {
                    NewParticle = new Particle2D(GraphicsDevice);
                    //Particle images should be grayscale, allowing this tint value to color them
                    NewParticle.Tint  = new Color(cRand.Next(0, 255), cRand.Next(0, 255), cRand.Next(0, 255));
                    NewParticle.Image = cTextureDict[eTexture];

                    //Set the dimensions of the image on screen
                    NewParticle.Height = cTextureDict[eTexture].Height / 2;
                    NewParticle.Width  = cTextureDict[eTexture].Width / 2;
                    //Set the position of the image
                    NewParticle.TopLeft.X = (GraphicsDevice.Viewport.Width / 2) - (NewParticle.Width / 2);
                    NewParticle.TopLeft.Y = (GraphicsDevice.Viewport.Height / 2) - (NewParticle.Height / 2);
                    NewParticle.Rotation  = (float)((cRand.Next(0, 360) * (2 * Math.PI)) / 360);

                    //Set the total movement the particle will travel
                    NewParticle.TotalDistance.X = cRand.Next(GraphicsDevice.Viewport.Width / -2, GraphicsDevice.Viewport.Width / 2);
                    NewParticle.TotalDistance.Y = cRand.Next(GraphicsDevice.Viewport.Height / -2, GraphicsDevice.Viewport.Height / 2);
                    NewParticle.TotalRotate     = (float)(cRand.Next(-5, 5) * 2 * Math.PI);

                    //Set how long the particle will live in milliseconds
                    NewParticle.TimeToLive = cRand.Next(1000, 10000);
                    NewParticle.AlphaFade  = true;

                    cSparkles.AddParticle(NewParticle);
                }
            }
            else
            {
                cDevConsole.AddText("Unrecognized command: " + CommandEvent);
            }
        }
Exemplo n.º 18
0
        public void TestRegEx()
        {
            RegEx re = new RegEx();

            Assert.IsTrue(re.Pattern == string.Empty);
            Assert.IsTrue(re.Replace == string.Empty);
            Assert.IsTrue(re.RegexOptions == string.Empty);
            Assert.IsTrue(re.ToLower == false);
        }
Exemplo n.º 19
0
 protected BaseType(string name, string pattern)
 {
     _name = name;
     if (pattern != null)
     {
         regex = new RegEx();
         regex.Compile(pattern);
     }
 }
Exemplo n.º 20
0
        public void SingleCharacterZeroOrOneTest()
        {
            RegEx regex = new RegEx("^ab?c$");

            Assert.IsNotNull(regex.Match("ac"));
            Assert.IsNotNull(regex.Match("abc"));

            Assert.IsNull(regex.Match("abbc"));
        }
Exemplo n.º 21
0
    private IRegExNode <char> ParseAlt()
    {
        var seq = this.ParseSeq();

        if (this.Match('|'))
        {
            return(RegEx.Or(seq, this.ParseAlt()));
        }
        return(seq);
    }
Exemplo n.º 22
0
    private IRegExNode <char> ParseSeq()
    {
        var postfx = this.ParsePostfix();

        if (!this.IsEnd && this.Peek() != '|' && this.Peek() != ')')
        {
            return(RegEx.Seq(postfx, this.ParseSeq()));
        }
        return(postfx);
    }
        private static void CheckLogicItem(EntropyResult er1, EntropyResult er2, int j)
        {
            RegEx re1 = er1.Logic.RegexList[j];
            RegEx re2 = er2.Logic.RegexList[j];

            Assert.IsTrue(re1.Pattern == re2.Pattern);
            Assert.IsTrue(re1.RegexOptions == re2.RegexOptions);
            Assert.IsTrue(re1.Replace == re2.Replace);
            Assert.IsTrue(re1.ToLower == re2.ToLower);
        }
Exemplo n.º 24
0
        public void RegExDfaEpsilonTest()
        {
            RegEx <char>    regEx    = RegExFactory.Epsilon <char>();
            RegExDfa <char> regExDfa = new RegExDfa <char>(regEx, 1);

            CheckNullTransitionTests(regExDfa);
            var dfaEpsilon = new RegExDfa <char>(new DFAState <char>(1, new KeyValuePair <char, DFAState <char> >[] { deadTransition }));

            Assert.IsTrue(DfaUtils.CompareDfa <RegExDfa <char>, DFAState <char>, char> .Compare(regExDfa, dfaEpsilon));
        }
Exemplo n.º 25
0
        public async Task <decimal> GetTaxForOrder(OrderVM order)
        {
            if (string.IsNullOrEmpty(order.ToCountry) || order.Shipping < 0)
            {
                throw new InvalidOperationException("ZipCode is a required data");
            }

            if (!string.IsNullOrEmpty(order.ToCountry))
            {
                if (!RegEx.IsValidCountry(order.ToCountry.ToUpper()))
                {
                    throw new InvalidOperationException("Destination country is not a valid Code");
                }

                if (order.ToCountry.ToLower() == "us" && string.IsNullOrEmpty(order.ToZip))
                {
                    throw new InvalidOperationException("ZipCode data is required when destination country is US");
                }

                if (order.ToCountry.ToLower() == "us" && !RegEx.isValidZipCode(order.ToZip))
                {
                    throw new InvalidOperationException("ZipCode data is not a valid US ZipCode");
                }

                if ((order.ToCountry.ToLower() == "us" || order.ToCountry.ToLower() == "ca") && string.IsNullOrEmpty(order.ToState))
                {
                    throw new InvalidOperationException("Destination state is required whe Destination country is US or CA");
                }
            }

            var orderApi = _mapper.Map <Order>(order);

            var client = new RestClient(Url)
            {
                Authenticator = new JwtAuthenticator(this.apiKey)
            };
            var request =
                new RestRequest("taxes")
            {
                Method        = Method.POST,
                RequestFormat = DataFormat.Json
            };

            request.AddJsonBody(JsonConvert.SerializeObject(orderApi));
            var response = await client.ExecutePostAsync(request);

            if (response.ResponseStatus != ResponseStatus.Completed || response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Something was wrong on the server");
            }

            var responseData = JsonConvert.DeserializeObject <TaxResponseAttributes>(response.Content);

            return(responseData.AmountToCollect);
        }
Exemplo n.º 26
0
        public void InCorrectGetalDecimaalTeVeelFormatTest()
        {
            //arrange
            RegEx checker = new RegEx();

            //act
            bool result = checker.Check("2.000");

            //assert
            Assert.IsFalse(result);
        }
Exemplo n.º 27
0
        public void InCorrectGetalLetteripvPuntFormatTest()
        {
            //arrange
            RegEx checker = new RegEx();

            //act
            bool result = checker.Check("2B00");

            //assert
            Assert.IsFalse(result);
        }
Exemplo n.º 28
0
        public void CorrectGetalBegintMetMinFormatTest()
        {
            //arrange
            RegEx checker = new RegEx();

            //act
            bool result = checker.Check("-2.00");

            //assert
            Assert.IsTrue(result);
        }
Exemplo n.º 29
0
        public void InCorrectGetalBegintMetLetterFormatTest()
        {
            //arrange
            RegEx checker = new RegEx();

            //act
            bool result = checker.Check("A2.00");

            //assert
            Assert.IsFalse(result);
        }
 public static bool regEx(this List <string> targetStrings, string regEx)
 {
     foreach (var targetString in targetStrings)
     {
         if (RegEx.findStringInString(targetString, regEx))
         {
             return(true);
         }
     }
     return(false);
 }