<commit_before>﻿using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using MongoDB.Driver;
using NUnit.Framework;
using OpenCat;

namespace WebApp.Specs
{
    [SetUpFixture]
    public class SetUp
    {
        private Process iisexpress;

        private string IISExpress
        {
            get
            {
                var programs = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
                return Path.Combine(programs, "IIS Express\\iisexpress.exe");
            }
        }

        private string SitePath
        {
            get
            {
                var path = new DirectoryInfo(Environment.CurrentDirectory);
                return Path.Combine(path.Parent.Parent.Parent.FullName, "WebApp");
            }
        }

        private int Port
        {
            get
            {
                return Int32.Parse(ConfigurationManager.AppSettings["port"]);
            }
        }

        [SetUp]
        public void RunBeforeAnyTests()
        {
            iisexpress = new Process();
            iisexpress.StartInfo = new ProcessStartInfo
            {
                WindowStyle = ProcessWindowStyle.Hidden,
                FileName = IISExpress,
                Arguments = String.Format("/path:{0} /port:{1}", SitePath, Port)
            };
            iisexpress.Start();
        }

        [TearDown]
        public void RunAfterAnyTests()
        {
            if (!iisexpress.HasExited)
            {
                iisexpress.Kill();
            }
        }
    }
}<commit_msg>Implement IDisposable on SetUp class in Specs<commit_after>﻿using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using MongoDB.Driver;
using NUnit.Framework;
using OpenCat;

namespace WebApp.Specs
{
    [SetUpFixture]
    public class SetUp : IDisposable
    {
        private Process iisexpress;

        private string IISExpress
        {
            get
            {
                var programs = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
                return Path.Combine(programs, "IIS Express\\iisexpress.exe");
            }
        }

        private string SitePath
        {
            get
            {
                var path = new DirectoryInfo(Environment.CurrentDirectory);
                return Path.Combine(path.Parent.Parent.Parent.FullName, "WebApp");
            }
        }

        private int Port
        {
            get
            {
                return Int32.Parse(ConfigurationManager.AppSettings["port"]);
            }
        }

        [SetUp]
        public void RunBeforeAnyTests()
        {
            iisexpress = new Process();
            iisexpress.StartInfo = new ProcessStartInfo
            {
                WindowStyle = ProcessWindowStyle.Hidden,
                FileName = IISExpress,
                Arguments = String.Format("/path:{0} /port:{1}", SitePath, Port)
            };
            iisexpress.Start();
        }

        [TearDown]
        public void RunAfterAnyTests()
        {
            if (!iisexpress.HasExited)
            {
                iisexpress.Kill();
            }
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        ~SetUp()
        {
            Dispose(false);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (iisexpress != null)
                {
                    iisexpress.Dispose();
                    iisexpress = null;
                }
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.08358208955223881, 'fraction_numerical': 0.0032564450474898234, 'mean_word_length': 1.3329113924050633, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3178775', 'n_tokens_mistral': 972, 'n_tokens_neox': 916, 'n_words': 183}