public void SetConvention() { JsonMemberNamingConventionAttribute attribute = new JsonMemberNamingConventionAttribute(); Assert.AreEqual(NamingConvention.None, attribute.Convention); attribute.Convention = NamingConvention.Pascal; Assert.AreEqual(NamingConvention.Pascal, attribute.Convention); }
public void CustomizationSkippedWhenNoneConvention() { TestPropertyDescriptor property = CreateTestProperty("foo"); IPropertyDescriptorCustomization customization = new JsonMemberNamingConventionAttribute(); customization.Apply(property); Assert.IsNull(property.CustomizedName); }
public void SetUnderscores() { var attribute = new JsonMemberNamingConventionAttribute(); Assert.AreEqual(UnderscoreConvention.None, attribute.Underscores); attribute.Underscores = UnderscoreConvention.Separate; Assert.AreEqual(UnderscoreConvention.Separate, attribute.Underscores); }
public void CustomizationSkippedWhenNoneConvention() { var property = CreateTestProperty("foo"); IPropertyDescriptorCustomization customization = new JsonMemberNamingConventionAttribute(); customization.Apply(property); Assert.IsNull(property.CustomizedName); }
public void SetConvention() { var attribute = new JsonMemberNamingConventionAttribute(); Assert.AreEqual(NamingConvention.None, attribute.Convention); attribute.Convention = NamingConvention.Pascal; Assert.AreEqual(NamingConvention.Pascal, attribute.Convention); }
static void TestNamingCase(string baseName, NamingConvention testCase, UnderscoreConvention testUnder, string expected) { var attribute = new JsonMemberNamingConventionAttribute(testCase, testUnder); var property = CreateTestProperty(baseName); IPropertyDescriptorCustomization customization = attribute; customization.Apply(property); Assert.AreEqual(expected, property.CustomizedName); }
public void CannotApplyToNullPropertyDescriptor() { IPropertyDescriptorCustomization customization = new JsonMemberNamingConventionAttribute(); customization.Apply(null); }
public void InitializeConvention() { JsonMemberNamingConventionAttribute attribute = new JsonMemberNamingConventionAttribute(NamingConvention.Pascal); Assert.AreEqual(NamingConvention.Pascal, attribute.Convention); }
public void DefaultInitializationYieldsNoneConvention() { JsonMemberNamingConventionAttribute attribute = new JsonMemberNamingConventionAttribute(); Assert.AreEqual(NamingConvention.None, attribute.Convention); }
private static void TestNamingCase(string baseName, NamingConvention testCase, string expected) { JsonMemberNamingConventionAttribute attribute = new JsonMemberNamingConventionAttribute(testCase); TestPropertyDescriptor property = CreateTestProperty(baseName); IPropertyDescriptorCustomization customization = attribute; customization.Apply(property); Assert.AreEqual(expected, property.CustomizedName); }
public void InitializeUnderscores() { JsonMemberNamingConventionAttribute attribute = new JsonMemberNamingConventionAttribute(NamingConvention.Pascal, UnderscoreConvention.Separate); Assert.AreEqual(UnderscoreConvention.Separate, attribute.Underscores); }
public void SetUnderscores() { JsonMemberNamingConventionAttribute attribute = new JsonMemberNamingConventionAttribute(); Assert.AreEqual(UnderscoreConvention.None, attribute.Underscores); attribute.Underscores = UnderscoreConvention.Separate; Assert.AreEqual(UnderscoreConvention.Separate, attribute.Underscores); }
public void CannotApplyToNullPropertyDescriptor() { IPropertyDescriptorCustomization customization = new JsonMemberNamingConventionAttribute(); customization.Apply(null); }
public void InitializeUnderscores() { var attribute = new JsonMemberNamingConventionAttribute(NamingConvention.Pascal, UnderscoreConvention.Separate); Assert.AreEqual(UnderscoreConvention.Separate, attribute.Underscores); }
public void InitializeConvention() { var attribute = new JsonMemberNamingConventionAttribute(NamingConvention.Pascal); Assert.AreEqual(NamingConvention.Pascal, attribute.Convention); }
public void DefaultInitializationYieldsNoneConvention() { var attribute = new JsonMemberNamingConventionAttribute(); Assert.AreEqual(NamingConvention.None, attribute.Convention); }