Exemplo n.º 1
0
        public void Test_That_SupressWarningsFrom_Works_When_Specified_Filters_Do_Not_Exist()
        {
            // Arrange
            var jscBadTypeForBitOperationWarning = new CompilerError {
                Type = WarningCode.JscBadTypeForBitOperation
            };
            var jscJscFunctionMasksVariableWarning = new CompilerError {
                Type = WarningCode.JscFunctionMasksVariable
            };

            var results = new CompilerResults
            {
                Warnings = new List <CompilerError>
                {
                    jscBadTypeForBitOperationWarning,
                    jscJscFunctionMasksVariableWarning,
                }
            };

            var supressWarnings = new List <string>
            {
                WarningCode.JscBadDeleteOperand,
                WarningCode.JscConstructorNotCallable,
            };

            // Act
            results.SupressWarningsFrom(supressWarnings);

            // Assert
            Assert.Equal(2, results.Warnings.Count);
            Assert.True(results.Warnings.Any(w => w == jscBadTypeForBitOperationWarning));
            Assert.True(results.Warnings.Any(w => w == jscJscFunctionMasksVariableWarning));
        }
Exemplo n.º 2
0
        public void Test_That_SupressWarningsFrom_Doesnt_Suppress_Any_Warnings_When_Passed_A_Null_Suppression_List()
        {
            // Arrange
            var jscBadTypeForBitOperationWarning = new CompilerError {
                Type = WarningCode.JscBadTypeForBitOperation
            };
            var jscJscFunctionMasksVariableWarning = new CompilerError {
                Type = WarningCode.JscFunctionMasksVariable
            };

            var results = new CompilerResults
            {
                Warnings = new List <CompilerError>
                {
                    jscBadTypeForBitOperationWarning,
                    jscJscFunctionMasksVariableWarning,
                }
            };

            // Act
            results.SupressWarningsFrom(null);

            // Assert
            Assert.Equal(2, results.Warnings.Count);
            Assert.True(results.Warnings.Any(w => w == jscBadTypeForBitOperationWarning));
            Assert.True(results.Warnings.Any(w => w == jscJscFunctionMasksVariableWarning));
        }
Exemplo n.º 3
0
        public void Test_That_SupressWarningsFrom_Filters_Out_A_Single_Warning()
        {
            // Arrange
            var jscBadTypeForBitOperationWarning = new CompilerError {
                Type = WarningCode.JscBadTypeForBitOperation
            };
            var jscConstructorNotCallableWarning = new CompilerError {
                Type = WarningCode.JscConstructorNotCallable
            };

            var results = new CompilerResults
            {
                Warnings = new List <CompilerError>
                {
                    new CompilerError {
                        Type = WarningCode.JscBadDeleteOperand
                    },
                    jscBadTypeForBitOperationWarning,
                    jscConstructorNotCallableWarning,
                }
            };

            var supressWarnings = new List <string>
            {
                WarningCode.JscBadDeleteOperand,
            };

            // Act
            results.SupressWarningsFrom(supressWarnings);

            // Assert
            Assert.Equal(2, results.Warnings.Count);
            Assert.True(results.Warnings.Any(w => w == jscBadTypeForBitOperationWarning));
            Assert.True(results.Warnings.Any(w => w == jscConstructorNotCallableWarning));
        }
        public void Test_That_SupressWarningsFrom_Doesnt_Suppress_Any_Warnings_When_Passed_A_Null_Suppression_List()
        {
            // Arrange
            var jscBadTypeForBitOperationWarning = new CompilerError { Type = WarningCode.JscBadTypeForBitOperation };
            var jscJscFunctionMasksVariableWarning = new CompilerError { Type = WarningCode.JscFunctionMasksVariable };

            var results = new CompilerResults
            {
                Warnings = new List<CompilerError>
                {
                    jscBadTypeForBitOperationWarning,
                    jscJscFunctionMasksVariableWarning,
                }
            };

            // Act
            results.SupressWarningsFrom(null);

            // Assert
            Assert.Equal(2, results.Warnings.Count);
            Assert.True(results.Warnings.Any(w => w == jscBadTypeForBitOperationWarning));
            Assert.True(results.Warnings.Any(w => w == jscJscFunctionMasksVariableWarning));
        }
        public void Test_That_SupressWarningsFrom_Filters_Out_A_Single_Warning()
        {
            // Arrange
            var jscBadTypeForBitOperationWarning = new CompilerError { Type = WarningCode.JscBadTypeForBitOperation };
            var jscConstructorNotCallableWarning = new CompilerError { Type = WarningCode.JscConstructorNotCallable };

            var results = new CompilerResults
            {
                Warnings = new List<CompilerError>
                {
                    new CompilerError { Type = WarningCode.JscBadDeleteOperand },
                    jscBadTypeForBitOperationWarning,
                    jscConstructorNotCallableWarning,
                }
            };

            var supressWarnings = new List<string>
            {
                WarningCode.JscBadDeleteOperand,
            };

            // Act
            results.SupressWarningsFrom(supressWarnings);

            // Assert
            Assert.Equal(2, results.Warnings.Count);
            Assert.True(results.Warnings.Any(w => w == jscBadTypeForBitOperationWarning));
            Assert.True(results.Warnings.Any(w => w == jscConstructorNotCallableWarning));
        }
        public void Test_That_SupressWarningsFrom_Works_When_Specified_Filters_Do_Not_Exist()
        {
            // Arrange
            var jscBadTypeForBitOperationWarning = new CompilerError { Type = WarningCode.JscBadTypeForBitOperation };
            var jscJscFunctionMasksVariableWarning = new CompilerError { Type = WarningCode.JscFunctionMasksVariable };

            var results = new CompilerResults
            {
                Warnings = new List<CompilerError>
                {
                    jscBadTypeForBitOperationWarning,
                    jscJscFunctionMasksVariableWarning,
                }
            };

            var supressWarnings = new List<string>
            {
                WarningCode.JscBadDeleteOperand,
                WarningCode.JscConstructorNotCallable,
            };

            // Act
            results.SupressWarningsFrom(supressWarnings);

            // Assert
            Assert.Equal(2, results.Warnings.Count);
            Assert.True(results.Warnings.Any(w => w == jscBadTypeForBitOperationWarning));
            Assert.True(results.Warnings.Any(w => w == jscJscFunctionMasksVariableWarning));
        }