Repository: microsoft/onefuzz
File: src/ApiService/Tests/OrmTest.cs (C#)

Code before:
        [Fact]
        public void TestFromtableEntity()
        {
            var converter = new EntityConverter();
            var tableEntity = new TableEntity(Guid.NewGuid().ToString(), "test") {
                {"the_date", DateTimeOffset.UtcNow },
                { "the_number", 1234},
                { "the_float", 12.34},
                { "the_enum", "the_two"},
                { "the_flag", "flag_one,flag_two"},
                { "a__special__name", "renamed"},
                { "the_object", "{\"the_name\": \"testName\", \"the_enum\": \"the_one\", \"the_flag\": \"flag_one,flag_two\"}"}
                { "test_null", null},
            };

            var entity1 = converter.ToRecord<Entity1>(tableEntity);

            Assert.NotNull(entity1);
            Assert.Equal(tableEntity.PartitionKey, entity1.Id.ToString());
            Assert.Equal(tableEntity.RowKey, entity1.TheName.ToString());
            Assert.Equal(tableEntity.GetDateTimeOffset("the_date"), entity1.TheDate);
            Assert.Equal(tableEntity.GetInt32("the_number"), entity1.TheNumber);
            Assert.Equal(tableEntity.GetDouble("the_float"), entity1.TheFloat);
            Assert.Equal(TestEnum.TheTwo, entity1.TheEnum);
            Assert.Equal(tableEntity.GetString("a__special__name"), entity1.Renamed);
            Assert.Equal(tableEntity.GetString("test_null"), null);

            Assert.Equal("testName", entity1.TheObject.TheName);
            Assert.Equal(TestEnum.TheOne, entity1.TheObject.TheEnum);
            Assert.Equal(TestFlagEnum.FlagOne | TestFlagEnum.FlagTwo, entity1.TheObject.TheFlag);

        }

        [Fact]
        public void TestConvertPascalToSnakeCase()
        {
            var testCases = new[] {
                ("simpleTest", "simple_test"),
                ("easy", "easy"),
                ("HTML", "html"),
                ("simpleXML", "simple_xml"),
                ("PDFLoad", "pdf_load"),
                ("startMIDDLELast", "start_middle_last"),
                ("AString", "a_string"),
                ("Some4Numbers234", "some4_numbers234"),
                ("TEST123String", "test123_string"),
                ("TheTwo", "the_two"),
                ("___Value2", "___value2"),
                ("V_A_L_U_E_3", "v_a_l_u_e_3"),
                ("ALLCAPS", "allcaps"),
            };

Review comment (suggestion):
replace with 
``` suggestion 
Assert.Equal(null, tableEntity.GetString("test_null"));
Assert.Equal(tableEntity.GetString("test_null"), entity1.TestNull);
```

Code after:

        [Fact]
        public void TestFromtableEntity()
        {
            var converter = new EntityConverter();
            var tableEntity = new TableEntity(Guid.NewGuid().ToString(), "test") {
                {"the_date", DateTimeOffset.UtcNow },
                { "the_number", 1234},
                { "the_float", 12.34},
                { "the_enum", "the_two"},
                { "the_flag", "flag_one,flag_two"},
                { "a__special__name", "renamed"},
                { "the_object", "{\"the_name\": \"testName\", \"the_enum\": \"the_one\", \"the_flag\": \"flag_one,flag_two\"}"},
                { "test_null", null},
            };

            var entity1 = converter.ToRecord<Entity1>(tableEntity);

            Assert.NotNull(entity1);
            Assert.Equal(tableEntity.PartitionKey, entity1.Id.ToString());
            Assert.Equal(tableEntity.RowKey, entity1.TheName.ToString());
            Assert.Equal(tableEntity.GetDateTimeOffset("the_date"), entity1.TheDate);
            Assert.Equal(tableEntity.GetInt32("the_number"), entity1.TheNumber);
            Assert.Equal(tableEntity.GetDouble("the_float"), entity1.TheFloat);
            Assert.Equal(TestEnum.TheTwo, entity1.TheEnum);
            Assert.Equal(tableEntity.GetString("a__special__name"), entity1.Renamed);
            Assert.Null(tableEntity.GetString("test_null"));
            Assert.Null(entity1.TestNull);

            Assert.Equal("testName", entity1.TheObject.TheName);
            Assert.Equal(TestEnum.TheOne, entity1.TheObject.TheEnum);
            Assert.Equal(TestFlagEnum.FlagOne | TestFlagEnum.FlagTwo, entity1.TheObject.TheFlag);

        }

        [Fact]
        public void TestConvertPascalToSnakeCase()
        {
            var testCases = new[] {
                ("simpleTest", "simple_test"),
                ("easy", "easy"),
                ("HTML", "html"),
                ("simpleXML", "simple_xml"),
                ("PDFLoad", "pdf_load"),
                ("startMIDDLELast", "start_middle_last"),
                ("AString", "a_string"),
                ("Some4Numbers234", "some4_numbers234"),
                ("TEST123String", "test123_string"),
                ("TheTwo", "the_two"),
                ("___Value2", "___value2"),
                ("V_A_L_U_E_3", "v_a_l_u_e_3"),