コード例 #1
0
        public void GetFieldNameForProperty_returns_right_name_for_camel_cased_property()
        {
            // Arrange
            var namingConventions = new DefaultNamingConventions(new PluralizationService());

            // Act
            var name = namingConventions.GetFieldNameForProperty(typeof(SomeClass).GetProperty("SomeKey"));

            // Assert
            name.Should().Be("some-key");
        }
コード例 #2
0
        public void GetFieldNameForProperty_returns_right_name_for_property_with_JsonProperty_attribute()
        {
            // Arrange
            var namingConventions = new DefaultNamingConventions(new PluralizationService());

            // Act
            var name = namingConventions.GetFieldNameForProperty(typeof(Band).GetProperty("Genre"));

            // Assert
            name.Should().Be("THE-GENRE");
        }
コード例 #3
0
        public void GetFieldNameForProperty_returns_right_name_for_id()
        {
            // Arrange
            var namingConventions = new DefaultNamingConventions(new PluralizationService());

            // Act
            var name = namingConventions.GetFieldNameForProperty(typeof(Author).GetProperty("Id"));

            // Assert
            name.Should().Be("id");
        }