<commit_before>﻿using System;
using System.Collections.Generic;
using NSpec;
using NSpecSpecs.WhenRunningSpecs;
using NUnit.Framework;

namespace NSpecSpecs.describe_RunningSpecs
{
    [TestFixture]
    class describe_context_level_afterAll : when_running_specs
    {
        class SpecClass : nspec
        {
            public static List<string> log;
            
            static SpecClass()
            {
                log = new List<string>();
            }

            void execution_of_context()
            {
                afterAll = () => log.Add("CONTEXT LEVEL AFTER ALL");

                afterEach = () => log.Add("context level after each");
                it["has test one"] = () => log.Add("test one executed");

                it["has test two"] = () => log.Add("test two executed");

                context["execution of tests three and four"] = () =>
                {
                    afterAll = () => log.Add("CONTEXT 2 LEVEL AFTER ALL");
                    afterEach = () => log.Add("context 2 level after each");

                    it["has test three"] = () => log.Add("test three executed");

                    it["has test four"] = () => log.Add("test four executed");
                };
            }
        }

        [SetUp]
        public void Setup()
        {
            Run(typeof (SpecClass));
        }

        [Test]
        public void should_execute_after_all_only_for_each_context_level()
        {
            SpecClass.log.should_be(new[]
                {
                    "test one executed",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL",
                    "test two executed",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL",
                    "test three executed",
                    "context 2 level after each",
                    "CONTEXT 2 LEVEL AFTER ALL",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL",
                    "test four executed",
                    "context 2 level after each",
                    "CONTEXT 2 LEVEL AFTER ALL",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL"
                });
        }
    }
}
<commit_msg>Added tests for method level aftereach and afterall<commit_after>﻿using System;
using System.Collections.Generic;
using NSpec;
using NSpecSpecs.WhenRunningSpecs;
using NUnit.Framework;

namespace NSpecSpecs.describe_RunningSpecs
{
    [TestFixture]
    class describe_context_level_afterAll : when_running_specs
    {
        class SpecClass : nspec
        {
            public static List<string> log;
            
            static SpecClass()
            {
                log = new List<string>();
            }

            void after_all()
            {
                log.Add("METHOD LEVEL AFTER ALL");
            }

            void after_each()
            {
                log.Add("method level after each");
            }

            void execution_of_context()
            {
                afterAll = () => log.Add("CONTEXT LEVEL AFTER ALL");

                afterEach = () => log.Add("context level after each");
                it["has test one"] = () => log.Add("test one executed");

                it["has test two"] = () => log.Add("test two executed");

                context["execution of tests three and four"] = () =>
                {
                    afterAll = () => log.Add("CONTEXT 2 LEVEL AFTER ALL");
                    afterEach = () => log.Add("context 2 level after each");

                    it["has test three"] = () => log.Add("test three executed");

                    it["has test four"] = () => log.Add("test four executed");
                };
            }
        }

        [SetUp]
        public void Setup()
        {
            Run(typeof (SpecClass));
        }

        [Test]
        public void should_execute_after_all_only_for_each_context_level()
        {
            SpecClass.log.should_be(new[]
                {
                    "test one executed",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL",
                    "method level after each",
                    "METHOD LEVEL AFTER ALL",
                    "test two executed",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL",
                    "method level after each",
                    "METHOD LEVEL AFTER ALL",
                    "test three executed",
                    "context 2 level after each",
                    "CONTEXT 2 LEVEL AFTER ALL",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL",
                    "method level after each",
                    "METHOD LEVEL AFTER ALL",
                    "test four executed",
                    "context 2 level after each",
                    "CONTEXT 2 LEVEL AFTER ALL",
                    "context level after each",
                    "CONTEXT LEVEL AFTER ALL",
                    "method level after each",
                    "METHOD LEVEL AFTER ALL"
                });
        }
    }
}

{'fraction_non_alphanumeric': 0.0958904109589041, 'fraction_numerical': 0.00228310502283105, 'mean_word_length': 1.2351190476190477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '3523073', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1228, 'n_words': 365}