GetDisplayName() public static method

Gets the display name for a Type as used by NUnit.
public static GetDisplayName ( Type type ) : string
type System.Type The Type for which a display name is needed.
return string
示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSuite"/> class.
        /// </summary>
        /// <param name="fixtureType">Type of the fixture.</param>
        public TestSuite(Type fixtureType) : base(fixtureType)
        {
            string name   = this.Name = TypeHelper.GetDisplayName(fixtureType);
            string nspace = fixtureType.Namespace;

            this.FullName = nspace != null && nspace != ""
                ? nspace + "." + name
                : name;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSuite"/> class.
        /// </summary>
        /// <param name="fixtureType">Type of the fixture.</param>
        public TestSuite(Type fixtureType) : base(fixtureType)
        {
            Name = TypeHelper.GetDisplayName(fixtureType);
            string nspace = fixtureType.Namespace;

            FullName = nspace != null && nspace != ""
                ? nspace + "." + Name
                : Name;
            Arguments = new object[0];
        }
示例#3
0
        /// <summary>
        /// Constructs a test for a specific type.
        /// </summary>
        protected Test(Type type)
        {
            Initialize(TypeHelper.GetDisplayName(type));

            string nspace = type.Namespace;

            if (nspace != null && nspace != "")
            {
                FullName = nspace + "." + Name;
            }
            Type = type;
        }
示例#4
0
        public TestSuite(Type fixtureType, object[] arguments)
            : base(fixtureType)
        {
            string text2      = (base.FullName = (base.Name = TypeHelper.GetDisplayName(fixtureType, arguments)));
            string @namespace = fixtureType.Namespace;

            if (@namespace != null && @namespace != "")
            {
                base.FullName = @namespace + "." + text2;
            }
            base.arguments = arguments;
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSuite"/> class.
        /// </summary>
        /// <param name="fixtureType">Type of the fixture.</param>
        /// <param name="arguments">The arguments.</param>
        public TestSuite(Type fixtureType, object[] arguments)
            : base(fixtureType)
        {
            string name = TypeHelper.GetDisplayName(fixtureType, arguments);

            this.Name = name;

            this.FullName = name;
            string nspace = fixtureType.Namespace;

            if (nspace != null && nspace != "")
            {
                this.FullName = nspace + "." + name;
            }
            this.arguments = arguments;
        }
示例#6
0
 /// <summary>
 /// Get the display name for an object of this type, constructed with the specified args.
 /// </summary>
 public string GetDisplayName(object[] args)
 {
     return(TypeHelper.GetDisplayName(Type, args));
 }
示例#7
0
 /// <summary>
 /// Get the display name for this type
 /// </summary>
 public string GetDisplayName()
 {
     return(TypeHelper.GetDisplayName(Type));
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ParameterizedFixtureSuite"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 public ParameterizedFixtureSuite(Type type) : base(type.Namespace, TypeHelper.GetDisplayName(type))
 {
     this.type = type;
 }
示例#9
0
 public string GetDisplayNameTests(Type type)
 {
     return(TypeHelper.GetDisplayName(type));
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ParameterizedFixtureSuite"/> class.
 /// </summary>
 /// <param name="type">The type that represents the suite.</param>
 public ParameterizedFixtureSuite(Type type) : base(type.Namespace, TypeHelper.GetDisplayName(type))
 {
     _genericFixture = type.GetTypeInfo().ContainsGenericParameters;
 }