<commit_before>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using SqlServerValidationToolkit.Model.Context;
using SqlServerValidationToolkit.UnitTests.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SqlServerValidationToolkit.UnitTests
{
    [TestClass]
    public class ValidationRuleTests
    {
        [TestMethod]
        public void TestCustomConnectionString()
        {
            using (SqlServerValidationToolkitContext entities = new SqlServerValidationToolkitContext("data source=localhost;initial catalog=ValidationToolkit_UnitTest;integrated security=True"))
            {
                entities.Columns.ToList().ForEach(c => Console.WriteLine(c.Column_id));
            }
        }

        [TestMethod]
        public void TestIsActive()
        {
            Initializer initializer = new Initializer();

            using (var ctx = new SqlServerValidationToolkitContext(Settings.Default.ConnectionString))
            {
                initializer.AddValidation(ctx);

                ctx.Validate();

                ctx.ValidationRules.ToList().ForEach(vr => vr.IsActive = false);

                ctx.SaveChanges();

                ctx.Validate();

                Assert.IsTrue(ctx.WrongValues.All(wv => wv.Is_Corrected));
            }

        }
    }
}
<commit_msg>SqlCe-db is deleted before test-run<commit_after>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using SqlServerValidationToolkit.Model.Context;
using SqlServerValidationToolkit.UnitTests.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SqlServerValidationToolkit.UnitTests
{
    [TestClass]
    public class ValidationRuleTests
    {
        [TestMethod]
        public void TestCustomConnectionString()
        {
            using (SqlServerValidationToolkitContext entities = new SqlServerValidationToolkitContext("data source=localhost;initial catalog=ValidationToolkit_UnitTest;integrated security=True"))
            {
                entities.Columns.ToList().ForEach(c => Console.WriteLine(c.Column_id));
            }
        }

        [TestMethod]
        public void TestIsActive()
        {
            Initializer initializer = new Initializer();

            File.Delete("SqlServerValidationToolkit.Model.Context.SqlServerValidationToolkitContext.sdf");
            using (var ctx = SqlServerValidationToolkitContext.Create())
            {
                initializer.AddValidation(ctx);

                ctx.Validate();

                ctx.ValidationRules.ToList().ForEach(vr => vr.IsActive = false);

                ctx.SaveChanges();

                ctx.Validate();

                Assert.IsTrue(ctx.WrongValues.All(wv => wv.Is_Corrected));
            }

        }
    }
}

{'fraction_non_alphanumeric': 0.08993797381116471, 'fraction_numerical': 0.0, 'mean_word_length': 2.5575980392156863, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4041644', 'n_tokens_mistral': 755, 'n_tokens_neox': 727, 'n_words': 122}