<commit_before>﻿using System.Dynamic;
using NUnit.Framework;
using Simple.Data.Mocking.Ado;

namespace Simple.Data.IntegrationTest
{
    [TestFixture]
    public class DatabaseTest : DatabaseIntegrationContext
    {
        protected override void SetSchema(MockSchemaProvider schemaProvider)
        {
            schemaProvider.SetTables(new[] { "dbo", "Users", "BASE TABLE" });
            schemaProvider.SetColumns(new object[] { "dbo", "Users", "Id", true },
                                            new[] { "dbo", "Users", "Name" },
                                            new[] { "dbo", "Users", "Password" },
                                            new[] { "dbo", "Users", "Age" });
            schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 });
        }

        [Test]
        public void TestFindEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id == 1);
            GeneratedSqlIs("select [dbo].[users].* from [dbo].[users] where [dbo].[users].[id] = @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindNotEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id != 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] != @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindGreaterThanWithInt32()
        {
            _db.Users.Find(_db.Users.Id > 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] > @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindGreaterThanOrEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id >= 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] >= @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindLessThanWithInt32()
        {
            _db.Users.Find(_db.Users.Id < 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] < @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindLessThanOrEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id <= 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] <= @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindByDynamicSingleColumn()
        {
            _db.Users.FindByName("Foo");
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[name] = @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestFindWithLike()
        {
            _db.Users.Find(_db.Users.Name.Like("Foo"));
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[name] like @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestFindAllWithLike()
        {
            _db.Users.FindAll(_db.Users.Name.Like("Foo")).ToList();
            GeneratedSqlIs("select [id],[name],[password],[age] from [dbo].[Users] where [dbo].[Users].[name] like @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestFindAllByDynamic()
        {
            _db.Users.FindAllByName("Foo").ToList();
            GeneratedSqlIs("select [id],[name],[password],[age] from [dbo].[Users] where [dbo].[Users].[name] = @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestInsertWithNamedArguments()
        {
            _db.Users.Insert(Name: "Steve", Age: 50);
            GeneratedSqlIs("insert into [dbo].[Users] ([Name],[Age]) values (@p0,@p1)");
            Parameter(0).Is("Steve");
            Parameter(1).Is(50);
        }

        [Test]
        public void TestInsertWithStaticTypeObject()
        {
            var user = new User { Name = "Steve", Age = 50 };
            _db.Users.Insert(user);
            GeneratedSqlIs("insert into [dbo].[Users] ([Name],[Password],[Age]) values (@p0,@p1,@p2)");
            Parameter(0).Is("Steve");
            Parameter(1).Is(null);
            Parameter(2).Is(50);
        }

        [Test]<commit_msg>Oops, inadverted deletion of a test<commit_after>﻿using System.Dynamic;
using NUnit.Framework;
using Simple.Data.Mocking.Ado;

namespace Simple.Data.IntegrationTest
{
    [TestFixture]
    public class DatabaseTest : DatabaseIntegrationContext
    {
        protected override void SetSchema(MockSchemaProvider schemaProvider)
        {
            schemaProvider.SetTables(new[] { "dbo", "Users", "BASE TABLE" });
            schemaProvider.SetColumns(new object[] { "dbo", "Users", "Id", true },
                                            new[] { "dbo", "Users", "Name" },
                                            new[] { "dbo", "Users", "Password" },
                                            new[] { "dbo", "Users", "Age" });
            schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 });
        }

        [Test]
        public void TestFindEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id == 1);
            GeneratedSqlIs("select [dbo].[users].* from [dbo].[users] where [dbo].[users].[id] = @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindNotEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id != 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] != @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindGreaterThanWithInt32()
        {
            _db.Users.Find(_db.Users.Id > 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] > @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindGreaterThanOrEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id >= 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] >= @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindLessThanWithInt32()
        {
            _db.Users.Find(_db.Users.Id < 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] < @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindLessThanOrEqualWithInt32()
        {
            _db.Users.Find(_db.Users.Id <= 1);
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[Id] <= @p1");
            Parameter(0).Is(1);
        }

        [Test]
        public void TestFindByDynamicSingleColumn()
        {
            _db.Users.FindByName("Foo");
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[name] = @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestFindWithLike()
        {
            _db.Users.Find(_db.Users.Name.Like("Foo"));
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where [dbo].[Users].[name] like @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestFindAllWithLike()
        {
            _db.Users.FindAll(_db.Users.Name.Like("Foo")).ToList();
            GeneratedSqlIs("select [id],[name],[password],[age] from [dbo].[Users] where [dbo].[Users].[name] like @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestFindByDynamicTwoColumns()
        {
            _db.Users.FindByNameAndPassword("Foo", "secret");
            GeneratedSqlIs("select [dbo].[Users].* from [dbo].[Users] where ([dbo].[Users].[name] = @p1 and [dbo].[Users].[password] = @p2)");
            Parameter(0).Is("Foo");
            Parameter(1).Is("secret");
        }

        [Test]
        public void TestFindAllByDynamic()
        {
            _db.Users.FindAllByName("Foo").ToList();
            GeneratedSqlIs("select [id],[name],[password],[age] from [dbo].[Users] where [dbo].[Users].[name] = @p1");
            Parameter(0).Is("Foo");
        }

        [Test]
        public void TestInsertWithNamedArguments()
        {
            _db.Users.Insert(Name: "Steve", Age: 50);
            GeneratedSqlIs("insert into [dbo].[Users] ([Name],[Age]) values (@p0,@p1)");
            Parameter(0).Is("Steve");
            Parameter(1).Is(50);
        }

        [Test]
        public void TestInsertWithStaticTypeObject()
        {
            var user = new User { Name = "Steve", Age = 50 };
            _db.Users.Insert(user);
            GeneratedSqlIs("insert into [dbo].[Users] ([Name],[Password],[Age]) values (@p0,@p1,@p2)");
            Parameter(0).Is("Steve");
            Parameter(1).Is(null);
            Parameter(2).Is(50);
        }

        [Test]
{'fraction_non_alphanumeric': 0.17255252570406795, 'fraction_numerical': 0.014528386231560126, 'mean_word_length': 1.886774193548387, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5757143', 'n_tokens_mistral': 2874, 'n_tokens_neox': 2650, 'n_words': 470}