Skip to content

Insert via TableName using Dynamic object with Invalid Column Casing #223

@mikependon

Description

@mikependon

The test below will fail if one of the casing of the dynamic object does not match with what in the database.

    [TestMethod]
    public void TestSqlConnectionStringsCrudViaTableName()
    {
        // Setup
        var text = Helper.GetUnicodeString();
        var entity = new
        {
            SessionId = Guid.NewGuid(),
            ColumnChar = text,
            ColumnNChar = text,
            ColumnNText = text,
            ColumnNVarChar = text,
            ColumnText = text,
            ColumnVarChar = text
        };

        using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb))
        {
            // Act Insert
            var id = connection.Insert(ClassMappedNameCache.Get<StringsClass>(), entity);

            // Act Query
            var data = connection.Query(ClassMappedNameCache.Get<StringsClass>(), new { SessionId = (Guid)id }).FirstOrDefault();

            // Assert
            Assert.IsNotNull(data);
            Assert.AreEqual(entity.ColumnChar, data.ColumnChar.Trim());
            Assert.AreEqual(entity.ColumnNChar, data.ColumnNChar.Trim());
            Assert.AreEqual(entity.ColumnNText, data.ColumnNText);
            Assert.AreEqual(entity.ColumnNVarChar, data.ColumnNVarChar);
            Assert.AreEqual(entity.ColumnText, data.ColumnText);
            Assert.AreEqual(entity.ColumnVarChar, data.ColumnVarChar);
        }
    }

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdeployedFeature or bug is deployed at the current releasepriorityTop priority feature or things to dotodoThings to be done in the future

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions