<commit_before>using EFCoreTools.Tests.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace EFCoreTools.Tests
{
    [TestClass]
    public class IndexTests
    {
        [TestMethod]
        public void CreateUniqueIndexTest()
        {
            /***************
                ASSIGN
            ****************/

            // Create a TestDbContext object using SQLite db.
            var context = TestDbContext.New("index_convention_tests");

            /***************
                ACT
            ****************/

            // Grab the Person Entity from the Model.
            var personEntity = context.Model.FindEntityType(typeof(Person));
            
            // Grab the indexes from the Person Entity in the model.
            var indexCount = personEntity.GetIndexes().Count();
            var idIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_id");
            var ssnIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_ssn");
            var zipCodeIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_zipcode");
            var fullNameIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_lastname_firstname_middlename");

            /***************
                ASSERT
            ****************/

            // Verify that the Person Entity exists in the Model.
            Assert.IsNotNull(personEntity);
            
            // Verify that the Indexes defined in the Person Model were created in the Entity.
            Assert.AreEqual(indexCount, 4);

            // Verify Id Index Settings.
            Assert.IsNotNull(idIndex);
            Assert.IsTrue(idIndex.IsUnique);
            Assert.IsTrue(idIndex.SqlServer().IsClustered ?? false);

            // Verify SSN Index Settings.
            Assert.IsNotNull(ssnIndex);
            Assert.IsTrue(ssnIndex.IsUnique);
            Assert.IsFalse(ssnIndex.SqlServer().IsClustered ?? false);

            // Verify ZipCode Index Settings.
            Assert.IsNotNull(zipCodeIndex);<commit_msg>Updated code comments<commit_after>using EFCoreTools.Tests.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace EFCoreTools.Tests
{
    [TestClass]
    public class IndexTests
    {
        [TestMethod]
        public void CreateUniqueIndexTest()
        {
            /**** ASSIGN ****/

            // Create a TestDbContext object using SQLite db.
            var context = TestDbContext.New("index_convention_tests");

            /**** ACT ****/

            // Grab the Person Entity from the Model.
            var personEntity = context.Model.FindEntityType(typeof(Person));
            
            // Grab the indexes from the Person Entity in the model.
            var indexCount = personEntity.GetIndexes().Count();
            var idIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_id");
            var ssnIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_ssn");
            var zipCodeIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_zipcode");
            var fullNameIndex = personEntity.GetIndexes().FirstOrDefault(x => x.SqlServer().Name.ToLower() == "ix_person_lastname_firstname_middlename");

            /**** ASSERT ****/

            // Verify that the Person Entity exists in the Model.
            Assert.IsNotNull(personEntity);
            
            // Verify that the Indexes defined in the Person Model were created in the Entity.
            Assert.AreEqual(indexCount, 4);

            // Verify Id Index Settings.
            Assert.IsNotNull(idIndex);
            Assert.IsTrue(idIndex.IsUnique);
            Assert.IsTrue(idIndex.SqlServer().IsClustered ?? false);

            // Verify SSN Index Settings.
            Assert.IsNotNull(ssnIndex);
            Assert.IsTrue(ssnIndex.IsUnique);
            Assert.IsFalse(ssnIndex.SqlServer().IsClustered ?? false);

            // Verify ZipCode Index Settings.
            Assert.IsNotNull(zipCodeIndex);
{'fraction_non_alphanumeric': 0.12204811299933789, 'fraction_numerical': 0.0004414036636504083, 'mean_word_length': 2.339719970523213, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3303184', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1164, 'n_words': 251}