/// <summary>
        /// Gets the trait values from the Category attribute.
        /// </summary>
        /// <param name="traitAttribute">The trait attribute containing the trait values.</param>
        /// <returns>The trait values.</returns>
        public IEnumerable <KeyValuePair <string, string> > GetTraits(IAttributeInfo traitAttribute)
        {
            PlatformID platform = (PlatformID)traitAttribute.GetConstructorArguments().First();

            if (!platform.HasFlag(PlatformID.Windows))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonWindowsTest));
            }
            if (!platform.HasFlag(PlatformID.Linux))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonLinuxTest));
            }
            if (!platform.HasFlag(PlatformID.OSX))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonOSXTest));
            }
            if (!platform.HasFlag(PlatformID.FreeBSD))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonFreeBSDTest));
            }
            if (!platform.HasFlag(PlatformID.NetBSD))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonNetBSDTest));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the trait values from the Category attribute.
        /// </summary>
        /// <param name="traitAttribute">The trait attribute containing the trait values.</param>
        /// <returns>The trait values.</returns>
        public IEnumerable <KeyValuePair <string, string> > GetTraits(IAttributeInfo traitAttribute)
        {
            string     issue     = traitAttribute.GetConstructorArguments().First().ToString();
            PlatformID platforms = (PlatformID)traitAttribute.GetConstructorArguments().Last();

            if (platforms.HasFlag(PlatformID.Windows))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonWindowsTest));
            }
            if (platforms.HasFlag(PlatformID.Linux))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonLinuxTest));
            }
            if (platforms.HasFlag(PlatformID.OSX))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.NonOSXTest));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the trait values from the Category attribute.
        /// </summary>
        /// <param name="traitAttribute">The trait attribute containing the trait values.</param>
        /// <returns>The trait values.</returns>
        public IEnumerable <KeyValuePair <string, string> > GetTraits(IAttributeInfo traitAttribute)
        {
            IEnumerable <object> ctorArgs = traitAttribute.GetConstructorArguments();

            Debug.Assert(ctorArgs.Count() >= 2);

            string     issue     = ctorArgs.First().ToString();
            PlatformID platforms = (PlatformID)ctorArgs.Last();

            if ((platforms.HasFlag(PlatformID.Windows) && Interop.IsWindows) ||
                (platforms.HasFlag(PlatformID.Linux) && Interop.IsLinux) ||
                (platforms.HasFlag(PlatformID.OSX) && Interop.IsOSX))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.Failing));

                yield return(new KeyValuePair <string, string>(XunitConstants.ActiveIssue, issue));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the trait values from the Category attribute.
        /// </summary>
        /// <param name="traitAttribute">The trait attribute containing the trait values.</param>
        /// <returns>The trait values.</returns>
        public IEnumerable <KeyValuePair <string, string> > GetTraits(IAttributeInfo traitAttribute)
        {
            IEnumerable <object> ctorArgs = traitAttribute.GetConstructorArguments();

            Debug.Assert(ctorArgs.Count() >= 2);

            string     issue     = ctorArgs.First().ToString();
            PlatformID platforms = (PlatformID)ctorArgs.Last();

            if ((platforms.HasFlag(PlatformID.FreeBSD) && RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) ||
                (platforms.HasFlag(PlatformID.Linux) && RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) ||
                (platforms.HasFlag(PlatformID.NetBSD) && RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD"))) ||
                (platforms.HasFlag(PlatformID.OSX) && RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) ||
                (platforms.HasFlag(PlatformID.Windows) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)))
            {
                yield return(new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.Failing));

                yield return(new KeyValuePair <string, string>(XunitConstants.ActiveIssue, issue));
            }
        }