<commit_before>﻿using System;
using System.IO;
using System.Linq;
using Bonobo.Git.Server.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Bonobo.Git.Server.Test.MembershipTests
{
    [TestClass]
    public class ADBackendStoreTest
    {
        private ADBackendStore<StorableClass> _store;

        [TestInitialize]
        public void Initialise()
        {
            Directory.Delete(Path.Combine(Path.GetTempPath(), "BonoboTestStore"), true);
            _store = MakeStore();
        }

        private static ADBackendStore<StorableClass> MakeStore()
        {
            return new ADBackendStore<StorableClass>(Path.GetTempPath(), "BonoboTestStore");
        }

        [TestMethod]
        public void NewStoreIsEmpty()
        {
            Assert.AreEqual(0, _store.Count());
        }

        [TestMethod]<commit_msg>More robust test folder handling<commit_after>﻿using System;
using System.IO;
using System.Linq;
using Bonobo.Git.Server.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Bonobo.Git.Server.Test.MembershipTests
{
    [TestClass]
    public class ADBackendStoreTest
    {
        private ADBackendStore<StorableClass> _store;
        private string _testDirectory;

        [TestInitialize]
        public void Initialise()
        {
            _testDirectory = Path.Combine(Path.GetTempPath(), "BonoboTestStore");
            SafelyDeleteTestData();
            _store = MakeStore();
        }

        [TestCleanup]
        public void Cleanup()
        {
            SafelyDeleteTestData();
        }

        private void SafelyDeleteTestData()
        {
            if (Directory.Exists(_testDirectory))
            {
                try
                {
                    Directory.Delete(_testDirectory, true);
                }
                catch
                {
                }
            }
        }

        private static ADBackendStore<StorableClass> MakeStore()
        {
            return new ADBackendStore<StorableClass>(Path.GetTempPath(), "BonoboTestStore");
        }

        [TestMethod]
        public void NewStoreIsEmpty()
        {
            Assert.AreEqual(0, _store.Count());
        }

        [TestMethod]
{'fraction_non_alphanumeric': 0.090049527239982, 'fraction_numerical': 0.0009004952723998199, 'mean_word_length': 1.950863213811421, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5034593', 'n_tokens_mistral': 625, 'n_tokens_neox': 589, 'n_words': 107}