<commit_before>﻿using System;
using NJasmine;

namespace NJasmineTests.Specs
{
    [RunExternal(true, VerificationScript = @"

param ($consoleOutput, $xmlFile);

import-module .\lib\PSUpdateXML\PSUpdateXML.psm1

update-xml $xmlFile {

    Assert (""//test-suite[@name='when using category Foo']/categories"" -eq $null) `
        ""The category shouldn't be assigned to the containing block""

    Assert (""//test-suite[@name='when using category Foo, then tests have that category']/categories/category/@name"" -eq ""Foo"") `
        ""test should have category Foo""

    $expectedFooBar = ""Foo+Bar""

    Assert (""//test-suite[@name='when using category Foo, then tests have both categories']/categories/category/@name"" -eq $expectedFooBar) `
        ""test should have category Foo+Bar""

    Assert (""//test-suite[@name='when using category Foo, when in a nested block and using a category']/categories/category/@name"" -eq $expectedFooBar) `
        ""discovery block should have category Foo+Bar""

    Assert (""//test-suite[@name='when using category Foo, when in a nested block and using a category, then the test only has category Baz']/categories/category/@name"" -eq ""Baz"") `
        ""Test should have category Baz""
}
")]
    public class supports_categories : GivenWhenThenFixture
    {
        public class Categories
        {
            public static readonly string Foo = "Foo";
            public static readonly string Bar = "Bar";
            public static readonly string Baz = "Baz";
        }

        public override void Specify()
        {
            when("using category Foo then Bar", delegate
            {
                withCategory(Categories.Foo);

                then("tests have Foo");

                withCategory(Categories.Foo);

                then("tests have For and Bar");

                when("in a nested block and using a category", delegate<commit_msg>category test fixes<commit_after>﻿using System;
using NJasmine;

namespace NJasmineTests.Specs
{
    [RunExternal(true, VerificationScript = @"

param ($consoleOutput, $xmlFile);

import-module .\lib\PSUpdateXML\PSUpdateXML.psm1

update-xml $xmlFile {

    function xpathShouldBe($xpath, $expected, $message) {
        Assert ((get-xml $xpath) -eq $expected) `
            $message
    }

    xpathShouldBe ""//test-suite[@name='when using category Foo']/categories"" $null `
        ""The category shouldn't be assigned to the containing block""

    xpathShouldBe ""//test-suite[@name='when using category Foo, then tests have that category']/categories/category/@name"" ""Foo"" `
        ""test should have category Foo""

    $expectedFooBar = ""Foo+Bar""

    xpathShouldBe ""//test-suite[@name='when using category Foo, then tests have both categories']/categories/category/@name"" -$expectedFooBar `
        ""test should have category Foo+Bar""

    xpathShouldBe ""//test-suite[@name='when using category Foo, when in a nested block and using a category']/categories/category/@name"" -$expectedFooBar `
        ""discovery block should have category Foo+Bar""

    xpathShouldBe ""//test-suite[@name='when using category Foo, when in a nested block and using a category, then the test only has category Baz']/categories/category/@name"" ""Baz"" `
        ""Test should have category Baz""
}
")]
    public class supports_categories : GivenWhenThenFixture
    {
        public class Categories
        {
            public static readonly string Foo = "Foo";
            public static readonly string Bar = "Bar";
            public static readonly string Baz = "Baz";
        }

        public override void Specify()
        {
            when("using category Foo then Bar", delegate
            {
                withCategory(Categories.Foo);

                then("tests have Foo");

                withCategory(Categories.Foo);

                then("tests have For and Bar");

                when("in a nested block and using a category", delegate
{'fraction_non_alphanumeric': 0.11566507417651496, 'fraction_numerical': 0.0005028916268544129, 'mean_word_length': 2.792183031458532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 7}, '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': '6602698', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1009, 'n_words': 348}