<commit_before>#region [R# naming]
// ReSharper disable ArrangeTypeModifiers
// ReSharper disable UnusedMember.Local
// ReSharper disable FieldCanBeMadeReadOnly.Local
// ReSharper disable ArrangeTypeMemberModifiers
// ReSharper disable InconsistentNaming
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using NSpectator;
using NSpectator.Domain;
using NUnit.Framework;

using DescribeOtherNamespace;
using DescribeSomeNamespace;
using Moq;

namespace NSpectator.Specs
{
    public class SpecClass : Spec
    {
        public void public_method() { }

        private void private_method() { }
    }

    public class AnotherSpecClass : Spec
    {
        void public_method() { }
    }

    public class NonSpecClass { }

    public class SpecClassWithNoVoidMethods : Spec
    {
        string parameter_less_method() { return ""; }
    }

    public class SpecClassWithNoParameterLessMethods : Spec
    {
        void private_method(string parameter) { }

        public void public_method(string parameter) { }
    }

    [TestFixture]
    [Category("SpecFinder")]
    public class Without_filtering : When_finding_specs
    {
        [SetUp]
        public void Setup()
        {
            GivenDllContains();
        }

        [Test]
        public void Should_get_types_from_reflection()
        {
            reflectorMock.Verify(r => r.GetTypesFrom());
        }

        [Test]
        public void Should_include_classes_that_implement_nspec_and_have_paramterless_void_methods()
        {
            GivenDllContains(typeof(SpecClass));

            finder.SpecClasses().should_contain(typeof(SpecClass));
        }

        [Test]
        public void Should_exclude_classes_that_inherit_from_nspec_but_have_no_parameterless_methods()
        {
            GivenDllContains(typeof(SpecClassWithNoParameterLessMethods));

            finder.SpecClasses().should_be_empty();
        }

        [Test]
        public void Should_exclude_classes_that_do_not_inherit_from_nspec()
        {
            GivenDllContains(typeof(NonSpecClass));

            finder.SpecClasses().should_be_empty();
        }

        [Test]
        public void Should_exclude_classes_that_have_no_void_methods()
        {
            GivenDllContains(typeof(SpecClassWithNoVoidMethods));

            finder.SpecClasses().should_be_empty();
        }
    }

    [TestFixture]
    [Category("SpecFinder")]
    public class When_filtering_specs : When_finding_specs
    {
        [Test]
        public void Should_filter_in()
        {
            GivenDllContains(typeof(AnotherSpecClass));

            GivenFilter(typeof(AnotherSpecClass).Name);

            finder.SpecClasses().should_contain(typeof(AnotherSpecClass));
        }

        [Test]
        public void Should_filter_out()
        {
            GivenDllContains(typeof(SpecClass));

            GivenFilter(typeof(AnotherSpecClass).Name);

            finder.SpecClasses().should_be_empty();
        }
    }

    [TestFixture]
    [Category("SpecFinder")]
    public class When_finding_specs_based_on_regex : When_finding_specs
    {
        [SetUp]
        public void Setup()
        {
            GivenDllContains(typeof(SomeClass),
                typeof(SomeDerivedClass),
                typeof(SomeClassInOtherNameSpace),
                typeof(SomeDerivedDerivedClass));
        }

        [Test]
        public void Should_find_all_specs_if_regex_is_not_specified()
        {
            GivenFilter("");

            TheSpecClasses()
                .should_contain(typeof(SomeClass))
                .should_contain(typeof(SomeDerivedClass))
                .should_contain(typeof(SomeClassInOtherNameSpace));
        }

        [Test]
        public void Should_find_specs_for_derived_class_and_include_base_class()
        {
            GivenFilter("DerivedClass$");

            TheSpecClasses()
                .should_contain(typeof(SomeClass))
                .should_contain(typeof(SomeDerivedClass))
                .should_contain(typeof(SomeDerivedDerivedClass))
                .should_not_contain(typeof(SomeClassInOtherNameSpace));

            TheSpecClasses().Count().should_be(3);
        }

        [Test]
        public void Should_find_specs_that_contain_namespace()
        {
            GivenFilter("describe_SomeNameSpace");

            TheSpecClasses()
                .should_contain(typeof(SomeClass))
                .should_contain(typeof(SomeDerivedClass))
                .should_not_contain(typeof(SomeClassInOtherNameSpace));
        }

        [Test]
        public void Should_find_distinct_specs()
        {
            GivenFilter("Derived");

            TheSpecClasses()
                .should_contain(typeof(SomeClass))
                .should_contain(typeof(SomeDerivedClass))
                .should_contain(typeof(SomeDerivedDerivedClass));

            TheSpecClasses().Count().should_be(3);
        }
    }

    public class When_finding_specs
    {
        protected void GivenDllContains(params Type[] types)
        {
            reflectorMock = new Mock<IReflector>();
            reflectorMock.Setup(r => r.GetTypesFrom()).Returns(types);

            someDLL = "some specs project dll";

            finder = new SpecFinder(reflectorMock.Object);
        }

        protected void GivenFilter(string filter)
        {
            finder = new SpecFinder(reflectorMock.Object, filter);
        }
        
        protected IEnumerable<Type> TheSpecClasses()
        {
            return finder.SpecClasses();
        }

        protected ISpecFinder finder;
        
        protected Mock<IReflector> reflectorMock;
        protected string someDLL;
    }
}

namespace DescribeSomeNamespace
{
    class SomeClass : Spec
    {
        void context_method()
        {
            
        }
    }

    class SomeDerivedClass : SomeClass
    {
        void context_method()
        {

        }
    }

    class SomeDerivedDerivedClass : SomeClass
    {
        void context_method()
        {

        }
    }
}

namespace DescribeOtherNamespace
{
    class SomeClassInOtherNameSpace : Spec
    {
        void context_method()
        {

        }
    }
}<commit_msg>Fix appveyor build fail<commit_after>#region [R# naming]
// ReSharper disable ArrangeTypeModifiers
// ReSharper disable UnusedMember.Local
// ReSharper disable FieldCanBeMadeReadOnly.Local
// ReSharper disable ArrangeTypeMemberModifiers
// ReSharper disable InconsistentNaming
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using NSpectator;
using NSpectator.Domain;
using NUnit.Framework;

using DescribeOtherNamespace;
using DescribeSomeNamespace;
using Moq;
using FluentAssertions;

namespace NSpectator.Specs
{
    public class SpecClass : Spec
    {
        public void public_method() { }

        private void private_method() { }
    }

    public class AnotherSpecClass : Spec
    {
        void public_method() { }
    }

    public class NonSpecClass { }

    public class SpecClassWithNoVoidMethods : Spec
    {
        string parameter_less_method() { return ""; }
    }

    public class SpecClassWithNoParameterLessMethods : Spec
    {
        void private_method(string parameter) { }

        public void public_method(string parameter) { }
    }

    [TestFixture]
    [Category("SpecFinder")]
    public class Without_filtering : When_finding_specs
    {
        [SetUp]
        public void Setup()
        {
            GivenDllContains();
        }

        [Test]
        public void Should_get_types_from_reflection()
        {
            reflectorMock.Verify(r => r.GetTypesFrom());
        }

        [Test]
        public void Should_include_classes_that_implement_nspec_and_have_paramterless_void_methods()
        {
            GivenDllContains(typeof(SpecClass));

            finder.SpecClasses().should_contain(typeof(SpecClass));
        }

        [Test]
        public void Should_exclude_classes_that_inherit_from_nspec_but_have_no_parameterless_methods()
        {
            GivenDllContains(typeof(SpecClassWithNoParameterLessMethods));

            finder.SpecClasses().should_be_empty();
        }

        [Test]
        public void Should_exclude_classes_that_do_not_inherit_from_nspec()
        {
            GivenDllContains(typeof(NonSpecClass));

            finder.SpecClasses().should_be_empty();
        }

        [Test]
        public void Should_exclude_classes_that_have_no_void_methods()
        {
            GivenDllContains(typeof(SpecClassWithNoVoidMethods));

            finder.SpecClasses().should_be_empty();
        }
    }

    [TestFixture]
    [Category("SpecFinder")]
    public class When_filtering_specs : When_finding_specs
    {
        [Test]
        public void Should_filter_in()
        {
            GivenDllContains(typeof(AnotherSpecClass));

            GivenFilter(typeof(AnotherSpecClass).Name);

            finder.SpecClasses().should_contain(typeof(AnotherSpecClass));
        }

        [Test]
        public void Should_filter_out()
        {
            GivenDllContains(typeof(SpecClass));

            GivenFilter(typeof(AnotherSpecClass).Name);

            finder.SpecClasses().should_be_empty();
        }
    }

    [TestFixture]
    [Category("SpecFinder")]
    public class When_finding_specs_based_on_regex : When_finding_specs
    {
        [SetUp]
        public void Setup()
        {
            GivenDllContains(typeof(SomeClass),
                typeof(SomeDerivedClass),
                typeof(SomeClassInOtherNameSpace),
                typeof(SomeDerivedDerivedClass));
        }

        [Test]
        public void Should_find_all_specs_if_regex_is_not_specified()
        {
            GivenFilter("");

            TheSpecClasses()
                .should_contain(typeof(SomeClass))
                .should_contain(typeof(SomeDerivedClass))
                .should_contain(typeof(SomeClassInOtherNameSpace));
        }

        [Test]
        public void Should_find_specs_for_derived_class_and_include_base_class()
        {
            GivenFilter("DerivedClass$");

            TheSpecClasses()
                .should_contain(typeof(SomeClass))
                .should_contain(typeof(SomeDerivedClass))
                .should_contain(typeof(SomeDerivedDerivedClass))
                .should_not_contain(typeof(SomeClassInOtherNameSpace));

            TheSpecClasses().Count().should_be(3);
        }

        [Test]
        public void Should_find_specs_that_contain_namespace()
        {
            GivenFilter("DescribeSomeNamespace");

            TheSpecClasses()
                .Should().Contain(typeof(SomeClass)).And
                .Contain(typeof(SomeDerivedClass)).And
                .NotContain(typeof(SomeClassInOtherNameSpace));
        }

        [Test]
        public void Should_find_distinct_specs()
        {
            GivenFilter("Derived");

            TheSpecClasses()
                .should_contain(typeof(SomeClass))
                .should_contain(typeof(SomeDerivedClass))
                .should_contain(typeof(SomeDerivedDerivedClass));

            TheSpecClasses().Count().should_be(3);
        }
    }

    public class When_finding_specs
    {
        protected void GivenDllContains(params Type[] types)
        {
            reflectorMock = new Mock<IReflector>();
            reflectorMock.Setup(r => r.GetTypesFrom()).Returns(types);

            someDLL = "some specs project dll";

            finder = new SpecFinder(reflectorMock.Object);
        }

        protected void GivenFilter(string filter)
        {
            finder = new SpecFinder(reflectorMock.Object, filter);
        }
        
        protected IEnumerable<Type> TheSpecClasses()
        {
            return finder.SpecClasses();
        }

        protected ISpecFinder finder;
        
        protected Mock<IReflector> reflectorMock;
        protected string someDLL;
    }
}

namespace DescribeSomeNamespace
{
    class SomeClass : Spec
    {
        void context_method()
        {
            
        }
    }

    class SomeDerivedClass : SomeClass
    {
        void context_method()
        {

        }
    }

    class SomeDerivedDerivedClass : SomeClass
    {
        void context_method()
        {

        }
    }
}

namespace DescribeOtherNamespace
{
    class SomeClassInOtherNameSpace : Spec
    {
        void context_method()
        {

        }
    }
}
{'fraction_non_alphanumeric': 0.08258354755784061, 'fraction_numerical': 0.00032133676092544985, 'mean_word_length': 2.139722572509458, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '5821580', 'n_tokens_mistral': 3501, 'n_tokens_neox': 3329, 'n_words': 519}