Exemplo n.º 1
0
        public void NameTest(string testShortName, INJasmineTest parentTest, INJasmineTest test)
        {
            test.TestName.Name = testShortName;
            test.TestName.FullName = parentTest.TestName.FullName + ", " + testShortName;
            test.SetMultilineName(parentTest.GetMultilineName() + ",\n" + testShortName);

            MakeNameUnique(test);
        }
Exemplo n.º 2
0
        public void NameFork(string testShortName, INJasmineTest parentTest, INJasmineTest test, out bool reusedName)
        {
            test.TestName.Name = testShortName;
            test.TestName.FullName = parentTest.TestName.FullName + ", " + testShortName;
            test.SetMultilineName(parentTest.GetMultilineName() + ",\n" + testShortName);

            IncrementTestNameUntilItsNot(test, IsReserved);

            reusedName = _globallyAccumulatedTestNames.ContainsKey(test.TestName.FullName);

            _globallyAccumulatedTestNames[test.TestName.FullName] = NameIs.Available;
        }
Exemplo n.º 3
0
        private void IncrementTestNameUntilItsNot(INJasmineTest test, Func<string, bool> condition)
        {
            var name = test.TestName.FullName;

            if (condition(name))
            {
                var nextIndex = 1;
                string suffix;
                string nextName;

                do
                {
                    suffix = "`" + ++nextIndex;
                    nextName = name + suffix;
                } while (condition(nextName));

                test.TestName.Name = test.TestName.Name + suffix;
                test.TestName.FullName = test.TestName.FullName + suffix;
                test.SetMultilineName(test.GetMultilineName() + suffix);
            }
        }
Exemplo n.º 4
0
 public void MakeNameUnique(INJasmineTest test)
 {
     IncrementTestNameUntilItsNot(test, name => _globallyAccumulatedTestNames.ContainsKey(name));
     _globallyAccumulatedTestNames[test.TestName.FullName] = NameIs.Reserved;
 }