<commit_before>// Copyright 2007 MbUnit Project - http://www.mbunit.com/
// Portions Copyright 2000-2004 <NAME>, <NAME>
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

extern alias MbUnit2;
using System;
using System.Collections.Generic;
using MbUnit.Core.Reporting;
using MbUnit2::MbUnit.Framework;
using Rhino.Mocks;

namespace MbUnit.Core.Tests.Reporting
{
    [TestFixture]
    [TestsOn(typeof(TestRun))]
    [Author("Vadim")]
    public class TestRunTests
    {
        private MockRepository _mocks;
        private IStepRun _stepRunMock;
        private TestRun _testRun;

        [SetUp]
        public void TestStart()
        {
            _mocks = new MockRepository();
            _stepRunMock = _mocks.CreateMock<IStepRun>();
            _testRun = new TestRun("id", _stepRunMock);
        }

        [RowTest]
        [Row(null, ExpectedException = typeof(ArgumentNullException))]
        [Row("newId")]
        public void ConstructorTest(string testId)
        {
            TestRun testRun = new TestRun(testId, _stepRunMock);
            Assert.AreEqual(testId, testRun.TestId);
        }

        [Test]
        [ExpectedArgumentNullException]
        public void ConstructorWithNullStepRun()
        {
            new TestRun("id", null);
        }

        [RowTest]
        [Row(null, ExpectedException = typeof(ArgumentNullException))]
        [Row("newId")]
        public void TestIdSetTest(string testId)
        {
            _testRun.TestId = testId;
            Assert.AreEqual(testId, _testRun.TestId);
        }

        [Test]
        public void RootStepRunTest()
        {
            SetupResult.For(_stepRunMock.StepId).PropertyBehavior();
            SetupResult.For(_stepRunMock.StepName).PropertyBehavior();
            _mocks.ReplayAll();
            _stepRunMock.StepId = "newStepId";
            _stepRunMock.StepName = "mockStepName";
            _testRun.RootStepRun = _stepRunMock;
            Assert.AreEqual("newStepId", _testRun.RootStepRun.StepId);
            Assert.AreEqual("mockStepName", _testRun.RootStepRun.StepName);
            _mocks.VerifyAll();
        }

        [Test]
        [ExpectedArgumentNullException]
        public void RootStepRunNullTest()
        {
            _testRun.RootStepRun = null;
        }

        [Test]
        public void StepRunsWithOneChildTest()
        {
            List<IStepRun> children = new List<IStepRun>();
            IStepRun stepRunChild = MockRepository.GenerateStub<IStepRun>();
            stepRunChild.StepId = "childId";
            stepRunChild.StepName = "childStepName";
            children.Add(stepRunChild);
            Expect.Call(_stepRunMock.StepId).PropertyBehavior();
            Expect.Call(_stepRunMock.StepName).PropertyBehavior();
            Expect.Call(_stepRunMock.Children).Return(children);
            _mocks.ReplayAll();
            _stepRunMock.StepId = "newStepId";
            _stepRunMock.StepName = "mockStepName";
            foreach (IStepRun step in _testRun.StepRuns)
            {
                Console.WriteLine(step.StepId);
            }
            _mocks.VerifyAll();
        }
    }<commit_msg>Fixed test for StepRuns property.<commit_after>// Copyright 2007 MbUnit Project - http://www.mbunit.com/
// Portions Copyright 2000-2004 <NAME>, <NAME>
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

extern alias MbUnit2;
using System;
using System.Collections.Generic;
using MbUnit.Core.Reporting;
using MbUnit2::MbUnit.Framework;
using Rhino.Mocks;

namespace MbUnit.Core.Tests.Reporting
{
    [TestFixture]
    [TestsOn(typeof(TestRun))]
    [Author("Vadim")]
    public class TestRunTests
    {
        private MockRepository _mocks;
        private IStepRun _stepRunMock;
        private TestRun _testRun;

        [SetUp]
        public void TestStart()
        {
            _mocks = new MockRepository();
            _stepRunMock = _mocks.CreateMock<IStepRun>();
            _testRun = new TestRun("id", _stepRunMock);
        }

        [RowTest]
        [Row(null, ExpectedException = typeof(ArgumentNullException))]
        [Row("newId")]
        public void ConstructorTest(string testId)
        {
            TestRun testRun = new TestRun(testId, _stepRunMock);
            Assert.AreEqual(testId, testRun.TestId);
        }

        [Test]
        [ExpectedArgumentNullException]
        public void ConstructorWithNullStepRun()
        {
            new TestRun("id", null);
        }

        [RowTest]
        [Row(null, ExpectedException = typeof(ArgumentNullException))]
        [Row("newId")]
        public void TestIdSetTest(string testId)
        {
            _testRun.TestId = testId;
            Assert.AreEqual(testId, _testRun.TestId);
        }

        [Test]
        public void RootStepRunTest()
        {
            SetupResult.For(_stepRunMock.StepId).PropertyBehavior();
            SetupResult.For(_stepRunMock.StepName).PropertyBehavior();
            _mocks.ReplayAll();
            _stepRunMock.StepId = "newStepId";
            _stepRunMock.StepName = "mockStepName";
            _testRun.RootStepRun = _stepRunMock;
            Assert.AreEqual("newStepId", _testRun.RootStepRun.StepId);
            Assert.AreEqual("mockStepName", _testRun.RootStepRun.StepName);
            _mocks.VerifyAll();
        }

        [Test]
        [ExpectedArgumentNullException]
        public void RootStepRunNullTest()
        {
            _testRun.RootStepRun = null;
        }

        [Test]
        public void StepRunsWithOneChildNoMockingTest()
        {
            List<IStepRun> stepRunList = new List<IStepRun>();
            StepRun parentStepRun = new StepRun("mainId", "mainName", "");
            StepRun stepRunChild = new StepRun("childId", "child", "fullName");
            parentStepRun.Children.Add(stepRunChild);
            TestRun testRun = new TestRun("tstRun", parentStepRun);
            foreach (IStepRun step in testRun.StepRuns)
            {
                stepRunList.Add(step);
                Console.WriteLine(step.StepId);
            }
            Assert.AreEqual("mainId", stepRunList[0].StepId);
            Assert.AreEqual("childId", stepRunList[1].StepId);
        }
    }
{'fraction_non_alphanumeric': 0.10012480931909583, 'fraction_numerical': 0.005269726806268201, 'mean_word_length': 2.2781818181818183, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2141437', 'n_tokens_mistral': 2054, 'n_tokens_neox': 2004, 'n_words': 459}