<commit_before>﻿using System;
using System.Collections.Generic;

using FluentAssemblyScanner.Tests.AdditionalAssembly;
using FluentAssemblyScanner.Tests.SpecClasses;
using FluentAssemblyScanner.Tests.SpecClasses.subPaymentMethodNamespace;

using FluentAssertions;

using Xunit;

namespace FluentAssemblyScanner.Tests
{
    public class FromAssemblyDefinerBase_Tests
    {
        [Fact]
        public void PickAny_count_should_be_greater_than_zero()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.PickAny().Filter().Scan().Count.Should().BeGreaterThan(0);
        }

        [Fact]
        public void should_filter_by_namespace()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .InSameNamespaceOf(typeof(IAdditionalAssemblyService))
                    .Filter()
                    .Scan().Count.Should().Be(0);
        }

        [Fact]
        public void when_sub_namespace_search_option_is_not_active_then_the_sub_namespaced_type_doesnt_count_inside_of_scanned_types()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .InSameNamespaceOf<IPaymentMethod>()
                    .Filter()
                    .Scan()
                    .Should().NotContain(typeof(DBankPaymentMethod));
        }

        [Fact]
        public void when_sub_namespace_search_option_is_active_then_the_sub_namespaced_type_counts_inside_of_scanned_types()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .InSameNamespaceOf<IPaymentMethod>(true)
                    .Filter()
                    .Scan()
                    .Should().Contain(typeof(DBankPaymentMethod));
        }

        [Fact]
        public void when_use_with_based_ons_and_classes_filter_should_work()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            List<Type> scannedTypes = instance.BasedOn<IPaymentMethod>()
                                              .OrBasedOn<IAdditionalAssemblyService>()
                                              .Filter()
                                              .Classes()
                                              .Scan();

            scannedTypes.Count.Should().Be(4);
        }

        [Fact]
        public void when_use_with_based_ons_and_filter_should_work_and_returns_also_interfaces()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            List<Type> scannedTypes = instance.BasedOn<IPaymentMethod>()
                                              .OrBasedOn<IAdditionalAssemblyService>()
                                              .Filter()
                                              .Scan();

            scannedTypes.Count.Should().Be(5);
        }

        [Fact]
        public void should_return_related_types_with_based_ons()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .OrBasedOn<IAdditionalAssemblyService>()
                    .Filter()<commit_msg>test fix<commit_after>﻿using System;
using System.Collections.Generic;

using FluentAssemblyScanner.Tests.AdditionalAssembly;
using FluentAssemblyScanner.Tests.SpecClasses;
using FluentAssemblyScanner.Tests.SpecClasses.subPaymentMethodNamespace;

using FluentAssertions;

using Xunit;

namespace FluentAssemblyScanner.Tests
{
    public class FromAssemblyDefinerBase_Tests
    {
        [Fact]
        public void PickAny_count_should_be_greater_than_zero()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.PickAny().Filter().Scan().Count.Should().BeGreaterThan(0);
        }

        [Fact]
        public void should_filter_by_namespace()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .InSameNamespaceOf(typeof(IAdditionalAssemblyService))
                    .Filter()
                    .Scan().Count.Should().Be(0);
        }

        [Fact]
        public void when_sub_namespace_search_option_is_not_active_then_the_sub_namespaced_type_doesnt_count_inside_of_scanned_types()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .InSameNamespaceOf<IPaymentMethod>()
                    .Filter()
                    .Scan()
                    .Should().NotContain(typeof(DBankPaymentMethod));
        }

        [Fact]
        public void when_sub_namespace_search_option_is_active_then_the_sub_namespaced_type_counts_inside_of_scanned_types()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .InSameNamespaceOf<IPaymentMethod>(true)
                    .Filter()
                    .Scan()
                    .Should().Contain(typeof(DBankPaymentMethod));
        }

        [Fact]
        public void when_use_with_based_ons_and_classes_filter_should_work()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            List<Type> scannedTypes = instance.BasedOn<IPaymentMethod>()
                                              .OrBasedOn<IAdditionalAssemblyService>()
                                              .Filter()
                                              .Classes()
                                              .Scan();

            scannedTypes.Count.Should().Be(5);
        }

        [Fact]
        public void when_use_with_based_ons_and_filter_should_work_and_returns_also_interfaces()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            List<Type> scannedTypes = instance.BasedOn<IPaymentMethod>()
                                              .OrBasedOn<IAdditionalAssemblyService>()
                                              .Filter()
                                              .Scan();

            scannedTypes.Count.Should().Be(7);
        }

        [Fact]
        public void should_return_related_types_with_based_ons()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            // None.

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            instance.BasedOn<IPaymentMethod>()
                    .OrBasedOn<IAdditionalAssemblyService>()
                    .Filter()
{'fraction_non_alphanumeric': 0.5291102357956078, 'fraction_numerical': 0.00043166243997194194, 'mean_word_length': 0.3625937362152625, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1564849', 'n_tokens_mistral': 2308, 'n_tokens_neox': 2211, 'n_words': 258}