<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.ObjectResolution;

namespace Umbraco.Tests.BootManagers
{
    [TestFixture]
    public class CoreBootManagerTests
    {

        private TestApp _testApp;

        [SetUp]
        public void Setup()
        {
            _testApp = new TestApp();
        }

        /// <summary>
        /// test application using a CoreBootManager instance to boot
        /// </summary>
        public class TestApp : UmbracoApplicationBase
        {
            protected override IBootManager GetBootManager()
            {
                return new TestBootManager(this);
            }
        }

        /// <summary>
        /// Test boot manager to add a custom application event handler
        /// </summary>
        public class TestBootManager : CoreBootManager
        {
            public TestBootManager(UmbracoApplicationBase umbracoApplication)
                : base(umbracoApplication)
            {
            }

            protected override void InitializeApplicationEventsResolver()
            {
                //create an empty resolver so we can add our own custom ones (don't type find)
                ApplicationEventsResolver.Current = new ApplicationEventsResolver(
                    Enumerable.Empty<Type>())
                    {
                        CanResolveBeforeFrozen = true
                    };
                ApplicationEventsResolver.Current.AddType<TestApplicationEventHandler>();
            }
        }

        /// <summary>
        /// test event handler
        /// </summary><commit_msg>Fixed CoreBootManagerTests to not initialize all resolvers for this specific test.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.ObjectResolution;

namespace Umbraco.Tests.BootManagers
{
    [TestFixture]
    public class CoreBootManagerTests
    {

        private TestApp _testApp;

        [SetUp]
        public void Setup()
        {
            _testApp = new TestApp();
        }

        [TearDown]
        public void TearDown()
        {
            _testApp = null;
            ApplicationEventsResolver.Reset();
            Resolution.IsFrozen = false;
        }

        /// <summary>
        /// test application using a CoreBootManager instance to boot
        /// </summary>
        public class TestApp : UmbracoApplicationBase
        {
            protected override IBootManager GetBootManager()
            {
                return new TestBootManager(this);
            }
        }

        /// <summary>
        /// Test boot manager to add a custom application event handler
        /// </summary>
        public class TestBootManager : CoreBootManager
        {
            public TestBootManager(UmbracoApplicationBase umbracoApplication)
                : base(umbracoApplication)
            {
            }

            protected override void InitializeApplicationEventsResolver()
            {
                //create an empty resolver so we can add our own custom ones (don't type find)
                ApplicationEventsResolver.Current = new ApplicationEventsResolver(
                    Enumerable.Empty<Type>())
                    {
                        CanResolveBeforeFrozen = true
                    };
                ApplicationEventsResolver.Current.AddType<TestApplicationEventHandler>();
            }

            protected override void InitializeResolvers()
            {
                //Do nothing as we don't want to initialize all resolvers in this test
            }
        }

        /// <summary>
        /// test event handler
        /// </summary>
{'fraction_non_alphanumeric': 0.07277907277907278, 'fraction_numerical': 0.0, 'mean_word_length': 1.6488340192043895, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '132611', 'n_tokens_mistral': 917, 'n_tokens_neox': 878, 'n_words': 243}