<commit_before>﻿using System;
using NUnit.Framework;

namespace Atata.Tests
{
    [TestFixture]
    public class AtataContextBuilderTests
    {
        [Test]
        public void AtataContextBuilder_Build_WithoutDriver()
        {
            InvalidOperationException exception = Assert.Throws<InvalidOperationException>(() =>
               AtataContext.Configure().Build());

            Assert.That(exception.Message, Does.Contain("no driver is specified"));
        }<commit_msg>Add AtataContextBuilder_OnDriverCreated and AtataContextBuilder_OnDriverCreated_RestartDriver tests<commit_after>﻿using System;
using NUnit.Framework;

namespace Atata.Tests
{
    public class AtataContextBuilderTests : UITestFixtureBase
    {
        [Test]
        public void AtataContextBuilder_Build_WithoutDriver()
        {
            InvalidOperationException exception = Assert.Throws<InvalidOperationException>(() =>
               AtataContext.Configure().Build());

            Assert.That(exception.Message, Does.Contain("no driver is specified"));
        }

        [Test]
        public void AtataContextBuilder_OnDriverCreated()
        {
            int executionsCount = 0;

            AtataContext.Configure().
                UseChrome().
                OnDriverCreated(driver =>
                {
                    executionsCount++;
                }).
                Build();

            Assert.That(executionsCount, Is.EqualTo(1));
        }

        [Test]
        public void AtataContextBuilder_OnDriverCreated_RestartDriver()
        {
            int executionsCount = 0;

            AtataContext.Configure().
                UseChrome().
                OnDriverCreated(() =>
                {
                    executionsCount++;
                }).
                Build();

            AtataContext.Current.RestartDriver();

            Assert.That(executionsCount, Is.EqualTo(2));
        }
{'fraction_non_alphanumeric': 0.08858780614903596, 'fraction_numerical': 0.0020844189682126106, 'mean_word_length': 1.9357798165137614, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6709404', 'n_tokens_mistral': 479, 'n_tokens_neox': 455, 'n_words': 79}