コード例 #1
0
        public void CellPhone_HappyDays()
        {
            var number = PhoneNumber.CellPhone();

            Assert.IsFalse(number.Contains("#"));
            Assert.IsFalse(string.IsNullOrWhiteSpace(number));
        }
コード例 #2
0
        public void PhoneNumber_Methods()
        {
            Func <object>[] actions = new[]
            {
                new Func <object>(() => PhoneNumber.CellPhone()),
                new Func <object>(() => PhoneNumber.LandLine())
            };

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

            foreach (Func <object> action in actions)
            {
                foreach (string loc in _localizations)
                {
                    ++totalExecutions;

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

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

            Assert.IsTrue(success);
            Assert.AreEqual(totalExecutions, successExecutions);
        }