<commit_before>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Certify.Core.Tests.Unit
{
    [TestClass]
    public class ManagedSiteTests
    {
        [TestMethod, Description("Ensure a large number of managed sites can be create, saved and loaded")]
        public void TestCheckLargeManagedSiteSettingSave()
        {
            var managedSiteSettings = new Management.ItemManager();
            managedSiteSettings.StorageSubfolder = "Tests";

            managedSiteSettings.LoadSettings();
            managedSiteSettings.DeleteAllManagedSites();
            managedSiteSettings.StoreSettings();

            var numTestManagedSites = 100000;
            var numSANsPerSite = 2;

            for (var i = 0; i < numTestManagedSites; i++)
            {
                var testname = Guid.NewGuid().ToString();
                var site = new Models.ManagedSite
                {
                    Id = Guid.NewGuid().ToString(),
                    Name = testname,
                    GroupId = "test",

                    RequestConfig = new Models.CertRequestConfig
                    {
                        PrimaryDomain = testname + ".com",
                        ChallengeType = "http-01",
                        PerformAutoConfig = true,
                        PerformAutomatedCertBinding = true,
                        PerformChallengeFileCopy = true,
                        PerformExtensionlessConfigChecks = true,
                        WebsiteRootPath = "c:\\inetpub\\wwwroot"<commit_msg>Reduce test sites to manageable number<commit_after>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Certify.Core.Tests.Unit
{
    [TestClass]
    public class ManagedSiteTests
    {
        [TestMethod, Description("Ensure a large number of managed sites can be create, saved and loaded")]
        public void TestCheckLargeManagedSiteSettingSave()
        {
            var managedSiteSettings = new Management.ItemManager();
            managedSiteSettings.StorageSubfolder = "Tests";

            managedSiteSettings.LoadSettings();
            managedSiteSettings.DeleteAllManagedSites();
            managedSiteSettings.StoreSettings();

            var numTestManagedSites = 10000;
            var numSANsPerSite = 2;

            for (var i = 0; i < numTestManagedSites; i++)
            {
                var testname = Guid.NewGuid().ToString();
                var site = new Models.ManagedSite
                {
                    Id = Guid.NewGuid().ToString(),
                    Name = testname,
                    GroupId = "test",

                    RequestConfig = new Models.CertRequestConfig
                    {
                        PrimaryDomain = testname + ".com",
                        ChallengeType = "http-01",
                        PerformAutoConfig = true,
                        PerformAutomatedCertBinding = true,
                        PerformChallengeFileCopy = true,
                        PerformExtensionlessConfigChecks = true,
                        WebsiteRootPath = "c:\\inetpub\\wwwroot"
{'fraction_non_alphanumeric': 0.07490396927016646, 'fraction_numerical': 0.006081946222791294, 'mean_word_length': 1.6216442953020134, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '826983', 'n_tokens_mistral': 757, 'n_tokens_neox': 692, 'n_words': 164}