OpenQA.Selenium.Platform.IsPlatformType C# (CSharp) Méthode

IsPlatformType() public méthode

Compares the platform to the specified type.
public IsPlatformType ( PlatformType compareTo ) : bool
compareTo PlatformType A value to compare to.
Résultat bool
        public bool IsPlatformType(PlatformType compareTo)
        {
            bool platformIsType = false;
            switch (compareTo)
            {
                case PlatformType.Any:
                    platformIsType = true;
                    break;

                case PlatformType.Windows:
                    platformIsType = this.platformTypeValue == PlatformType.Windows || this.platformTypeValue == PlatformType.XP || this.platformTypeValue == PlatformType.Vista;
                    break;

                case PlatformType.Vista:
                    platformIsType = this.platformTypeValue == PlatformType.Windows || this.platformTypeValue == PlatformType.Vista;
                    break;

                case PlatformType.XP:
                    platformIsType = this.platformTypeValue == PlatformType.Windows || this.platformTypeValue == PlatformType.XP;
                    break;

                // Thanks to a bug in Mono Mac and Linux need to be treated the same  https://bugzilla.novell.com/show_bug.cgi?id=515570 but adding this in case
                case PlatformType.MacOSX:
                    platformIsType = this.platformTypeValue == PlatformType.MacOSX || this.platformTypeValue == PlatformType.Darwin;
                    break;

                case PlatformType.Linux:
                    platformIsType = this.platformTypeValue == PlatformType.Linux || this.platformTypeValue == PlatformType.Unix;
                    break;

                default:
                    platformIsType = this.platformTypeValue == compareTo;
                    break;
            }

            return platformIsType;
        }