コード例 #1
0
        public void Skips_BothMacOSXAndLinux()
        {
            // Act
            var osSkipAttributeLinux  = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.MacOSX, OperatingSystems.Linux, string.Empty);
            var osSkipAttributeMacOSX = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.MacOSX, OperatingSystems.MacOSX, string.Empty);

            // Assert
            Assert.False(osSkipAttributeLinux.IsMet);
            Assert.False(osSkipAttributeMacOSX.IsMet);
        }
コード例 #2
0
        public void Skips_BothWindowsAndLinux()
        {
            // Act
            var osSkipAttribute      = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, OperatingSystems.Windows, string.Empty);
            var osSkipAttributeLinux = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, OperatingSystems.Linux, string.Empty);

            // Assert
            Assert.False(osSkipAttribute.IsMet);
            Assert.False(osSkipAttributeLinux.IsMet);
        }
コード例 #3
0
        public void Skips_BothMacOSXAndWindows()
        {
            // Act
            var osSkipAttribute       = new OSSkipConditionAttribute(OperatingSystems.Windows | OperatingSystems.MacOSX, OperatingSystems.Windows, string.Empty);
            var osSkipAttributeMacOSX = new OSSkipConditionAttribute(OperatingSystems.Windows | OperatingSystems.MacOSX, OperatingSystems.MacOSX, string.Empty);

            // Assert
            Assert.False(osSkipAttribute.IsMet);
            Assert.False(osSkipAttributeMacOSX.IsMet);
        }
コード例 #4
0
        public void DoesNotSkip_WhenOperatingSystemDoesNotMatch()
        {
            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(
                OperatingSystems.Linux,
                OperatingSystems.Windows,
                "2.5");

            // Assert
            Assert.True(osSkipAttribute.IsMet);
        }
コード例 #5
0
        public void Skips_WhenOnlyOperatingSystemIsSupplied()
        {
            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(
                OperatingSystems.Windows,
                OperatingSystems.Windows,
                "2.5");

            // Assert
            Assert.False(osSkipAttribute.IsMet);
        }
コード例 #6
0
        public void Skips_WhenVersionsMatchesOutOfMultiple()
        {
            // Arrange
            var env = new MockRuntimeEnvironment("Windows", "2.5", Platform.Windows);

            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Windows, env, "10.0", "3.4", "2.5");

            // Assert
            Assert.False(osSkipAttribute.IsMet);
        }
コード例 #7
0
        public void Skips_WhenVersionsMatches(string currentOSVersion, string skipVersion)
        {
            // Arrange
            var env = new MockRuntimeEnvironment("Windows", currentOSVersion, Platform.Windows);

            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Windows, env, skipVersion);

            // Assert
            Assert.False(osSkipAttribute.IsMet);
        }
コード例 #8
0
        public void DoesNotSkip_WhenOnlyVersionsMatch()
        {
            // Arrange
            var env = new MockRuntimeEnvironment("Windows", "2.5", Platform.Windows);

            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Linux, env, "2.5");

            // Assert
            Assert.True(osSkipAttribute.IsMet);
        }
コード例 #9
0
        public void Skips_WhenOnlyOperatingSystemIsSupplied()
        {
            // Arrange
            var env = new MockRuntimeEnvironment("Windows", "2.5", Platform.Windows);

            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Windows, env);

            // Assert
            Assert.False(osSkipAttribute.IsMet);
        }
コード例 #10
0
        public void Skips_WhenVersionsMatchesOutOfMultiple()
        {
            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(
                OperatingSystems.Windows,
                OperatingSystems.Windows,
                "2.5",
                "10.0", "3.4", "2.5");

            // Assert
            Assert.False(osSkipAttribute.IsMet);
        }
コード例 #11
0
        public void Skips_WhenVersionsMatches(string currentOSVersion, string skipVersion)
        {
            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(
                OperatingSystems.Windows,
                OperatingSystems.Windows,
                currentOSVersion,
                skipVersion);

            // Assert
            Assert.False(osSkipAttribute.IsMet);
        }
コード例 #12
0
        public void DoesNotSkip_WhenVersionsDoNotMatch()
        {
            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(
                OperatingSystems.Windows,
                Platform.Windows,
                "2.5",
                "10.0");

            // Assert
            Assert.True(osSkipAttribute.IsMet);
        }
コード例 #13
0
        public void Throws_OnUnrecognizedOperatingSystem()
        {
            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(
                OperatingSystems.Windows,
                Platform.Unknown,
                "2.5");

            // Assert
            var exception = Assert.Throws <InvalidOperationException>(() => osSkipAttribute.IsMet);

            Assert.Equal($"Unrecognized operating system '{Platform.Unknown}'.", exception.Message);
        }
コード例 #14
0
        public void Throws_OnUnrecognizedOperatingSystem()
        {
            // Arrange
            var osName = "Blah";
            var env    = new MockRuntimeEnvironment(osName, "2.5", Platform.Unknown);

            // Act
            var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Windows, env);

            // Assert
            var exception = Assert.Throws <InvalidOperationException>(() => osSkipAttribute.IsMet);

            Assert.Equal($"Unrecognized operating system '{Platform.Unknown}'.", exception.Message);
        }