<commit_before>﻿using Coalesce.Web.Tests.Helpers;
using Intellitect.ComponentModel.TypeDefinition;
using Intellitect.Extensions.CodeGenerators.Mvc;
using Intellitect.Extensions.CodeGenerators.Mvc.Scripts;
using Microsoft.CodeAnalysis;
using Microsoft.DotNet.ProjectModel;
using Microsoft.VisualStudio.Web.CodeGeneration;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace Coalesce.Web.Tests
{
    public class SecurityTests : IDisposable
    {
        private Process _process;
        private ProjectContext _dataContext;
        private List<ClassViewModel> _models;
        private readonly Uri _apiUri = new Uri("http://localhost:5000");

        public SecurityTests()
        {
            _process = Processes.StartDotNet();
            _dataContext = DependencyProvider.ProjectContext(@"..\..\..\..\..\Coalesce.Domain");

            IModelTypesLocator typeLocator = DependencyProvider.ModelTypesLocator(_dataContext);
            ModelType dataModel = ValidationUtil.ValidateType("AppDbContext", "dataContext", typeLocator, throwWhenNotFound: false);
            _models = ReflectionRepository
                            .AddContext((INamedTypeSymbol)dataModel.TypeSymbol)
                            .Where(m => m.PrimaryKey != null)
                            .ToList();
        }

        //[Fact(Skip = "Run Explicitly By Removing Skip", DisplayName = "Security Tests: Remove Skip To Run")]
        [Fact]
        public async Task AllTests()
        {
            using (var output = new StreamWriter("output.txt"))<commit_msg>Comment out [Fact] on SecurityTests so they have to be done manually.<commit_after>﻿using Coalesce.Web.Tests.Helpers;
using Intellitect.ComponentModel.TypeDefinition;
using Intellitect.Extensions.CodeGenerators.Mvc;
using Intellitect.Extensions.CodeGenerators.Mvc.Scripts;
using Microsoft.CodeAnalysis;
using Microsoft.DotNet.ProjectModel;
using Microsoft.VisualStudio.Web.CodeGeneration;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace Coalesce.Web.Tests
{
    public class SecurityTests : IDisposable
    {
        private Process _process;
        private ProjectContext _dataContext;
        private List<ClassViewModel> _models;
        private readonly Uri _apiUri = new Uri("http://localhost:5000");

        public SecurityTests()
        {
            _process = Processes.StartDotNet();
            _dataContext = DependencyProvider.ProjectContext(@"..\..\..\..\..\Coalesce.Domain");

            IModelTypesLocator typeLocator = DependencyProvider.ModelTypesLocator(_dataContext);
            ModelType dataModel = ValidationUtil.ValidateType("AppDbContext", "dataContext", typeLocator, throwWhenNotFound: false);
            _models = ReflectionRepository
                            .AddContext((INamedTypeSymbol)dataModel.TypeSymbol)
                            .Where(m => m.PrimaryKey != null)
                            .ToList();
        }

        [Fact(Skip = "Run Explicitly By Removing Skip", DisplayName = "Security Tests: Remove Skip To Run")]
        //[Fact]
        public async Task AllTests()
        {
            using (var output = new StreamWriter("output.txt"))
{'fraction_non_alphanumeric': 0.09590261282660333, 'fraction_numerical': 0.0023752969121140144, 'mean_word_length': 2.912891986062718, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7473190', 'n_tokens_mistral': 885, 'n_tokens_neox': 856, 'n_words': 200}