<commit_before>using CSharpGuidelinesAnalyzer.Rules.ClassDesign;
using CSharpGuidelinesAnalyzer.Test.TestDataBuilders;
using Microsoft.CodeAnalysis.Diagnostics;
using Xunit;

namespace CSharpGuidelinesAnalyzer.Test.Specs.ClassDesign
{
    public sealed class TypeShouldHaveASinglePurposeSpecs : CSharpGuidelinesAnalysisTestFixture
    {
        protected override string DiagnosticId => TypeShouldHaveASinglePurposeAnalyzer.DiagnosticId;

        [Fact]
        internal void When_class_name_contains_the_word_And_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    class [|CustomerAndOrder|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'CustomerAndOrder' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_struct_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    struct [|customer_and_order|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'customer_and_order' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_uppercase_struct_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    struct [|CUSTOMER_AND_ORDER|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'CUSTOMER_AND_ORDER' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_enum_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    enum [|Match1And2|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'Match1And2' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_uppercase_enum_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    enum [|MATCH1AND2|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'MATCH1AND2' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_class_name_contains_the_word_Land_it_must_be_skipped()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    class TheBigLand
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source);
        }

        [Fact]
        internal void When_struct_name_contains_the_word_Andy_it_must_be_skipped()<commit_msg>AV1000: Add tests for interfaces and delegates<commit_after>using CSharpGuidelinesAnalyzer.Rules.ClassDesign;
using CSharpGuidelinesAnalyzer.Test.TestDataBuilders;
using Microsoft.CodeAnalysis.Diagnostics;
using Xunit;

namespace CSharpGuidelinesAnalyzer.Test.Specs.ClassDesign
{
    public sealed class TypeShouldHaveASinglePurposeSpecs : CSharpGuidelinesAnalysisTestFixture
    {
        protected override string DiagnosticId => TypeShouldHaveASinglePurposeAnalyzer.DiagnosticId;

        [Fact]
        internal void When_class_name_contains_the_word_And_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    class [|CustomerAndOrder|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'CustomerAndOrder' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_struct_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    struct [|customer_and_order|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'customer_and_order' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_uppercase_interface_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    interface [|CUSTOMER_AND_ORDER|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'CUSTOMER_AND_ORDER' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_enum_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    enum [|Match1And2|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'Match1And2' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_uppercase_enum_name_contains_the_word_and_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    enum [|MATCH1AND2|]
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'MATCH1AND2' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_delegate_name_contains_the_word_And_it_must_be_reported()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    delegate void [|CustomerAndOrder|]();
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source,
                "Type 'CustomerAndOrder' contains the word 'and', which suggests in has multiple purposes.");
        }

        [Fact]
        internal void When_class_name_contains_the_word_Land_it_must_be_skipped()
        {
            // Arrange
            ParsedSourceCode source = new TypeSourceCodeBuilder()
                .InGlobalScope(@"
                    class TheBigLand
                    {
                    }
                ")
                .Build();

            // Act and assert
            VerifyGuidelineDiagnostic(source);
        }

        [Fact]
        internal void When_struct_name_contains_the_word_Andy_it_must_be_skipped()
{'fraction_non_alphanumeric': 0.06859997563055928, 'fraction_numerical': 0.0024369440721335447, 'mean_word_length': 1.4872727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1095750', 'n_tokens_mistral': 2092, 'n_tokens_neox': 1944, 'n_words': 407}