コード例 #1
0
        public void Code_Methods()
        {
            Func <object>[] codeActions = new[]
            {
                new Func <object>(() => Code.Asin()),
                new Func <object>(() => Code.Ean()),
                new Func <object>(() => Code.Imei()),
                new Func <object>(() => Code.Isbn()),
                new Func <object>(() => Code.Npi()),
                new Func <object>(() => Code.Nric()),
                new Func <object>(() => Code.Rut()),
                new Func <object>(() => Code.Sin())
            };

            bool success           = true;
            int  totalExecutions   = 0;
            int  successExecutions = 0;
            int  failedExecutions  = 0;

            foreach (Func <object> codeAction in codeActions)
            {
                foreach (string loc in _localizations)
                {
                    ++totalExecutions;

                    if (!TryCatch(codeAction, loc))
                    {
                        success = false;
                        ++failedExecutions;
                    }
                    else
                    {
                        ++successExecutions;
                    }
                }
            }

            Console.WriteLine($"{failedExecutions} of {totalExecutions} executions failed");

            Assert.IsTrue(success);
            Assert.AreEqual(totalExecutions, successExecutions);
        }
コード例 #2
0
        public void Asin()
        {
            var asin = Code.Asin();

            Assert.AreEqual(1, RegexMatchesCount(asin, @"^B000([A-Z]|\d){6}$"));
        }