Пример #1
0
        internal static TestName Create(TestCaseInfo caze)
        {
            string assembly = null;
            string ns       = null;
            string clazz    = null;
            string binding  = null;
            IEnumerable <string> arguments = Array.Empty <string>();

            if (caze.TestMethodArguments != null)
            {
                arguments = caze.TestMethodArguments.Select(
                    TextUtility.ConvertToString
                    );
            }

            foreach (var a in caze.Ancestors())
            {
                switch (a)
                {
                case TestSubjectClassBinding m:
                    binding = TextUtility.ConvertToSimpleTypeName(m.TestSubject.GetType(), qualified: true);
                    break;

                case TestAssembly m:
                    assembly = m.Assembly.FullName;
                    break;

                case TestNamespace m:
                    ns = m.Namespace;
                    break;

                case TestClassInfo m:
                    clazz = m.TestClass.Name;
                    break;
                }
            }
            return(new TestName(
                       assembly, ns, clazz, binding, caze.MethodName, caze.Position, caze.TestData.Name, arguments
                       ));
        }