diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index d5a6e9a270..be1c767ee7 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -146,7 +146,7 @@ current.Parent is CodeClass parentClass && var refinedName = refineAccessorName(currentProperty.Name); if (!refinedName.Equals(currentProperty.Name, StringComparison.Ordinal) && - !parentClass.Properties.Any(property => !property.Name.Equals(property.Name, StringComparison.Ordinal) && refinedName.Equals(property.Name, StringComparison.OrdinalIgnoreCase)))// ensure the refinement won't generate a duplicate + !parentClass.Properties.Any(property => !property.Name.Equals(property.Name, StringComparison.Ordinal) && refinedName.Equals(property.Name, StringComparison.Ordinal)))// ensure the refinement won't generate a duplicate { if (string.IsNullOrEmpty(currentProperty.SerializationName)) currentProperty.SerializationName = currentProperty.Name; diff --git a/src/Kiota.Builder/Refiners/JavaRefiner.cs b/src/Kiota.Builder/Refiners/JavaRefiner.cs index 29b12fd6d5..2ab9f1ed99 100644 --- a/src/Kiota.Builder/Refiners/JavaRefiner.cs +++ b/src/Kiota.Builder/Refiners/JavaRefiner.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -8,7 +7,6 @@ using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; using Kiota.Builder.Writers.Java; -using Microsoft.VisualBasic; namespace Kiota.Builder.Refiners; public class JavaRefiner : CommonLanguageRefiner, ILanguageRefiner diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index 20dc875e46..e72119e704 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -331,7 +331,7 @@ private void WriteConstructorBody(CodeClass parentClass, CodeMethod currentMetho .Where(static x => x.Type is not CodeType propType || propType.TypeDefinition is not CodeClass propertyClass || propertyClass.OriginalComposedType is null) .OrderBy(static x => x.Name)) { - var setterName = propWithDefault.SetterFromCurrentOrBaseType?.Name is string sName && !string.IsNullOrEmpty(sName) ? sName : $"set{propWithDefault.Name}"; + var setterName = propWithDefault.SetterFromCurrentOrBaseType?.Name is string sName && !string.IsNullOrEmpty(sName) ? sName : $"set{propWithDefault.Name.ToFirstCharacterUpperCase()}"; var defaultValue = propWithDefault.DefaultValue; if (propWithDefault.Type is CodeType propertyType && propertyType.TypeDefinition is CodeEnum enumDefinition) { @@ -358,7 +358,7 @@ private void WriteConstructorBody(CodeClass parentClass, CodeMethod currentMetho private static void WriteSetterBody(CodeMethod codeElement, LanguageWriter writer, CodeClass parentClass) { if (parentClass.GetBackingStoreProperty() is CodeProperty backingStore) - writer.WriteLine($"this.get{backingStore.Name}().set(\"{codeElement.AccessedProperty?.Name}\", value);"); + writer.WriteLine($"this.get{backingStore.Name.ToFirstCharacterUpperCase()}().set(\"{codeElement.AccessedProperty?.Name}\", value);"); else { string value = "PeriodAndDuration".Equals(codeElement.AccessedProperty?.Type?.Name, StringComparison.OrdinalIgnoreCase) ? "PeriodAndDuration.ofPeriodAndDuration(value);" : "value;"; @@ -379,12 +379,12 @@ private void WriteGetterBody(CodeMethod codeElement, LanguageWriter writer, Code writer.WriteLine($"{conventions.GetTypeString(codeElement.AccessedProperty.Type, codeElement)} value = this.{backingStore.NamePrefix}{backingStore.Name}\");"); writer.StartBlock("if(value == null) {"); writer.WriteLines($"value = {codeElement.AccessedProperty.DefaultValue};", - $"this.set{codeElement.AccessedProperty?.Name}(value);"); + $"this.set{codeElement.AccessedProperty?.Name.ToFirstCharacterUpperCase()}(value);"); writer.CloseBlock(); writer.WriteLine("return value;"); } else - writer.WriteLine($"return this.get{backingStore.Name}().get(\"{codeElement.AccessedProperty?.Name}\");"); + writer.WriteLine($"return this.get{backingStore.Name.ToFirstCharacterUpperCase()}().get(\"{codeElement.AccessedProperty?.Name}\");"); } private void WriteIndexerBody(CodeMethod codeElement, CodeClass parentClass, LanguageWriter writer, string returnType) diff --git a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs index fc69031a14..33099b3b28 100644 --- a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs @@ -183,7 +183,7 @@ public async Task DoesNotEscapesReservedKeywordsForClassOrPropertyKind() // Assert Assert.Equal("break", model.Name); Assert.DoesNotContain("@", model.Name); // classname will be capitalized - Assert.Equal("alias", property.Name); + Assert.Equal("Alias", property.Name); Assert.DoesNotContain("@", property.Name); // classname will be capitalized } diff --git a/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs index b81dc3a700..e81a45548d 100644 --- a/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs @@ -21,11 +21,11 @@ public async Task DoesNotReplacesReservedEnumOptions() }).First(); var option = new CodeEnumOption { - Name = "break", // this a keyword + Name = "Void", // this a keyword }; model.AddOption(option); await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Java }, root); - Assert.Equal("break", option.Name); + Assert.Equal("Void", option.Name); Assert.Empty(option.SerializationName); } [Fact] @@ -436,7 +436,7 @@ public async Task NormalizeMethodTypesNames() method.AddParameter(nonNormalizedParam); method.AddParameter(normalizedParam); await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Java }, root); - Assert.Equal("foo_bar", method.Parameters.First().Type.Name); + Assert.Equal("Foo_bar", method.Parameters.First().Type.Name); Assert.Equal("FooBaz", method.Parameters.Last().Type.Name); } [Fact] diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs index 352c999b09..a0b704cc89 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs @@ -89,6 +89,6 @@ public void WritesEnumSerializationValue() currentEnum.AddOption(option); writer.Write(currentEnum); var result = tw.ToString(); - Assert.Contains($"Plus_1(\"+1\")", result); + Assert.Contains($"plus_1(\"+1\")", result); } } diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index 7f56c8f4ca..18d6ab4221 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -43,27 +43,27 @@ private void setup(bool withInheritance = false) { baseClass = root.AddClass(new CodeClass { - Name = "someParentClass", + Name = "SomeParentClass", }).First(); baseClass.AddProperty(new CodeProperty { Name = "definedInParent", Type = new CodeType { - Name = "string" + Name = "String" }, Kind = CodePropertyKind.Custom, }); } parentClass = new CodeClass { - Name = "parentClass" + Name = "ParentClass" }; if (withInheritance) { parentClass.StartBlock.Inherits = new CodeType { - Name = "someParentClass", + Name = "SomeParentClass", TypeDefinition = baseClass }; } @@ -105,7 +105,7 @@ private void AddRequestProperties() Kind = CodePropertyKind.PathParameters, Type = new CodeType { - Name = "string", + Name = "String", } }); parentClass.AddProperty(new CodeProperty @@ -114,7 +114,7 @@ private void AddRequestProperties() Kind = CodePropertyKind.UrlTemplate, Type = new CodeType { - Name = "string", + Name = "String", } }); } @@ -126,22 +126,22 @@ private void AddSerializationProperties() Kind = CodePropertyKind.AdditionalData, Type = new CodeType { - Name = "string" + Name = "String" }, Getter = new CodeMethod { - Name = "GetAdditionalData", + Name = "getAdditionalData", ReturnType = new CodeType { - Name = "string" + Name = "String" } }, Setter = new CodeMethod { - Name = "SetAdditionalData", + Name = "setAdditionalData", ReturnType = new CodeType { - Name = "string" + Name = "String" } } }); @@ -150,19 +150,19 @@ private void AddSerializationProperties() Name = "dummyProp", Type = new CodeType { - Name = "string" + Name = "String" }, Getter = new CodeMethod { - Name = "GetDummyProp", + Name = "getDummyProp", ReturnType = new CodeType { - Name = "string" + Name = "String" }, }, Setter = new CodeMethod { - Name = "SetDummyProp", + Name = "setDummyProp", ReturnType = new CodeType { Name = "void" @@ -175,7 +175,7 @@ private void AddSerializationProperties() Kind = CodePropertyKind.Custom, Type = new CodeType { - Name = "string" + Name = "String" } }); parentClass.AddProperty(new CodeProperty @@ -183,21 +183,21 @@ private void AddSerializationProperties() Name = "dummyColl", Type = new CodeType { - Name = "string", + Name = "String", CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array, }, Getter = new CodeMethod { - Name = "GetDummyColl", + Name = "getDummyColl", ReturnType = new CodeType { - Name = "string", + Name = "String", CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array, }, }, Setter = new CodeMethod { - Name = "SetDummyColl", + Name = "setDummyColl", ReturnType = new CodeType { Name = "void", @@ -218,16 +218,16 @@ private void AddSerializationProperties() }, Getter = new CodeMethod { - Name = "GetDummyComplexColl", + Name = "getDummyComplexColl", ReturnType = new CodeType { - Name = "string", + Name = "String", CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array, }, }, Setter = new CodeMethod { - Name = "SetDummyComplexColl", + Name = "setDummyComplexColl", ReturnType = new CodeType { Name = "void" @@ -247,15 +247,15 @@ private void AddSerializationProperties() }, Getter = new CodeMethod { - Name = "GetDummyEnumCollection", + Name = "getDummyEnumCollection", ReturnType = new CodeType { - Name = "string" + Name = "String" }, }, Setter = new CodeMethod { - Name = "SetDummyEnumCollection", + Name = "setDummyEnumCollection", ReturnType = new CodeType { Name = "void" @@ -301,7 +301,7 @@ private CodeClass AddUnionTypeWrapper() }; var sType = new CodeType { - Name = "string", + Name = "String", }; unionTypeWrapper.DiscriminatorInformation.AddDiscriminatorMapping("#kiota.complexType1", new CodeType { @@ -323,7 +323,7 @@ private CodeClass AddUnionTypeWrapper() Kind = CodePropertyKind.Custom, Setter = new CodeMethod { - Name = "SetComplexType1Value", + Name = "setComplexType1Value", ReturnType = new CodeType { Name = "void" @@ -332,7 +332,7 @@ private CodeClass AddUnionTypeWrapper() }, Getter = new CodeMethod { - Name = "GetComplexType1Value", + Name = "getComplexType1Value", ReturnType = cType1, Kind = CodeMethodKind.Getter, } @@ -344,7 +344,7 @@ private CodeClass AddUnionTypeWrapper() Kind = CodePropertyKind.Custom, Setter = new CodeMethod { - Name = "SetComplexType2Value", + Name = "setComplexType2Value", ReturnType = new CodeType { Name = "void" @@ -353,7 +353,7 @@ private CodeClass AddUnionTypeWrapper() }, Getter = new CodeMethod { - Name = "GetComplexType2Value", + Name = "getComplexType2Value", ReturnType = cType2, Kind = CodeMethodKind.Getter, } @@ -365,7 +365,7 @@ private CodeClass AddUnionTypeWrapper() Kind = CodePropertyKind.Custom, Setter = new CodeMethod { - Name = "SetStringValue", + Name = "setStringValue", ReturnType = new CodeType { Name = "void" @@ -374,7 +374,7 @@ private CodeClass AddUnionTypeWrapper() }, Getter = new CodeMethod { - Name = "GetStringValue", + Name = "getStringValue", ReturnType = sType, Kind = CodeMethodKind.Getter, } @@ -444,7 +444,7 @@ private CodeClass AddIntersectionTypeWrapper() }); var sType = new CodeType { - Name = "string", + Name = "String", }; intersectionTypeWrapper.OriginalComposedType.AddType(cType1); intersectionTypeWrapper.OriginalComposedType.AddType(cType2); @@ -457,7 +457,7 @@ private CodeClass AddIntersectionTypeWrapper() Kind = CodePropertyKind.Custom, Setter = new CodeMethod { - Name = "SetComplexType1Value", + Name = "setComplexType1Value", ReturnType = new CodeType { Name = "void" @@ -466,7 +466,7 @@ private CodeClass AddIntersectionTypeWrapper() }, Getter = new CodeMethod { - Name = "GetComplexType1Value", + Name = "getComplexType1Value", ReturnType = cType1, Kind = CodeMethodKind.Getter, } @@ -478,7 +478,7 @@ private CodeClass AddIntersectionTypeWrapper() Kind = CodePropertyKind.Custom, Setter = new CodeMethod { - Name = "SetComplexType2Value", + Name = "setComplexType2Value", ReturnType = new CodeType { Name = "void" @@ -487,7 +487,7 @@ private CodeClass AddIntersectionTypeWrapper() }, Getter = new CodeMethod { - Name = "GetComplexType2Value", + Name = "getComplexType2Value", ReturnType = cType2, Kind = CodeMethodKind.Getter, } @@ -499,7 +499,7 @@ private CodeClass AddIntersectionTypeWrapper() Kind = CodePropertyKind.Custom, Setter = new CodeMethod { - Name = "SetComplexType3Value", + Name = "setComplexType3Value", ReturnType = new CodeType { Name = "void" @@ -508,7 +508,7 @@ private CodeClass AddIntersectionTypeWrapper() }, Getter = new CodeMethod { - Name = "GetComplexType3Value", + Name = "getComplexType3Value", ReturnType = cType3, Kind = CodeMethodKind.Getter, } @@ -520,7 +520,7 @@ private CodeClass AddIntersectionTypeWrapper() Kind = CodePropertyKind.Custom, Setter = new CodeMethod { - Name = "SetStringValue", + Name = "setStringValue", ReturnType = new CodeType { Name = "void" @@ -529,7 +529,7 @@ private CodeClass AddIntersectionTypeWrapper() }, Getter = new CodeMethod { - Name = "GetStringValue", + Name = "getStringValue", ReturnType = sType, Kind = CodeMethodKind.Getter, } @@ -540,7 +540,7 @@ private void AddRequestBodyParameters(bool useComplexTypeForBody = false) { var stringType = new CodeType { - Name = "string", + Name = "String", }; var requestConfigClass = parentClass.AddInnerClass(new CodeClass { @@ -790,17 +790,17 @@ public void WritesModelFactoryBody() setup(); var parentModel = root.AddClass(new CodeClass { - Name = "parentModel", + Name = "ParentModel", Kind = CodeClassKind.Model, }).First(); var childModel = root.AddClass(new CodeClass { - Name = "childModel", + Name = "ChildModel", Kind = CodeClassKind.Model, }).First(); childModel.StartBlock.Inherits = new CodeType { - Name = "parentModel", + Name = "ParentModel", TypeDefinition = parentModel, }; var factoryMethod = parentModel.AddMethod(new CodeMethod @@ -809,7 +809,7 @@ public void WritesModelFactoryBody() Kind = CodeMethodKind.Factory, ReturnType = new CodeType { - Name = "parentModel", + Name = "ParentModel", TypeDefinition = parentModel, }, IsStatic = true, @@ -851,17 +851,17 @@ public void WritesModelSplitFactoryBody() setup(); var parentModel = root.AddClass(new CodeClass { - Name = "parentModel", + Name = "ParentModel", Kind = CodeClassKind.Model, }).First(); var childModel = root.AddClass(new CodeClass { - Name = "childModel", + Name = "ChildModel", Kind = CodeClassKind.Model, }).First(); childModel.StartBlock.Inherits = new CodeType { - Name = "parentModel", + Name = "ParentModel", TypeDefinition = parentModel, }; var factoryMethod = parentModel.AddMethod(new CodeMethod @@ -870,7 +870,7 @@ public void WritesModelSplitFactoryBody() Kind = CodeMethodKind.Factory, ReturnType = new CodeType { - Name = "parentModel", + Name = "ParentModel", TypeDefinition = parentModel, }, IsStatic = true, @@ -999,7 +999,7 @@ public void WritesModelSplitFactoryOverloadBody() Assert.DoesNotContain("if (mappingValueNode != null) {", result); Assert.DoesNotContain("final String mappingValue = mappingValueNode.getStringValue()", result); Assert.Contains("switch (value) {", result); - Assert.Contains("case \"#microsoft.graph.Foo535\": return new ChildModel();", result); + Assert.Contains("case \"#microsoft.graph.Foo535\": return new childModel();", result); Assert.DoesNotContain("final ParentModel factory_1_result = factory_1(mappingValue);", result); Assert.DoesNotContain("if (factory_1_result != null) {", result); Assert.DoesNotContain("return new ParentModel()", result); @@ -1049,12 +1049,12 @@ public void DoesntWriteFactorySwitchOnEmptyPropertyName() setup(); var parentModel = root.AddClass(new CodeClass { - Name = "parentModel", + Name = "ParentModel", Kind = CodeClassKind.Model, }).First(); var childModel = root.AddClass(new CodeClass { - Name = "childModel", + Name = "ChildModel", Kind = CodeClassKind.Model, }).First(); childModel.StartBlock.Inherits = new CodeType @@ -1068,14 +1068,14 @@ public void DoesntWriteFactorySwitchOnEmptyPropertyName() Kind = CodeMethodKind.Factory, ReturnType = new CodeType { - Name = "parentModel", + Name = "ParentModel", TypeDefinition = parentModel, }, IsStatic = true, }).First(); parentModel.DiscriminatorInformation.AddDiscriminatorMapping("ns.childmodel", new CodeType { - Name = "childModel", + Name = "ChildModel", TypeDefinition = childModel, }); parentModel.DiscriminatorInformation.DiscriminatorPropertyName = string.Empty; @@ -1110,7 +1110,7 @@ public void DoesntWriteFactorySwitchOnEmptyMappings() setup(); var parentModel = root.AddClass(new CodeClass { - Name = "parentModel", + Name = "ParentModel", Kind = CodeClassKind.Model, }).First(); var factoryMethod = parentModel.AddMethod(new CodeMethod @@ -1119,7 +1119,7 @@ public void DoesntWriteFactorySwitchOnEmptyMappings() Kind = CodeMethodKind.Factory, ReturnType = new CodeType { - Name = "parentModel", + Name = "ParentModel", TypeDefinition = parentModel, }, IsStatic = true, @@ -1286,7 +1286,7 @@ public void WritesUnionDeSerializerBody() var wrapper = AddUnionTypeWrapper(); var deserializationMethod = wrapper.AddMethod(new CodeMethod { - Name = "GetFieldDeserializers", + Name = "getFieldDeserializers", Kind = CodeMethodKind.Deserializer, IsAsync = false, ReturnType = new CodeType @@ -1470,7 +1470,7 @@ public void WritesMethodAsyncDescription() Name = ParamName, Type = new CodeType { - Name = "string" + Name = "String" } }; method.AddParameter(parameter); @@ -1500,7 +1500,7 @@ public void WritesMethodSyncDescription() Name = ParamName, Type = new CodeType { - Name = "string" + Name = "String" } }; method.AddParameter(parameter); @@ -1526,7 +1526,7 @@ public void WritesMethodDescriptionLink() Name = ParamName, Type = new CodeType { - Name = "string" + Name = "String" } }; method.AddParameter(parameter); @@ -1614,7 +1614,7 @@ public void WritesIndexer() Name = "idx", ReturnType = new CodeType { - Name = "string" + Name = "String" }, IndexParameter = new() { @@ -1646,7 +1646,7 @@ public void WritesPathParameterRequestBuilder() Kind = CodeParameterKind.Path, Type = new CodeType { - Name = "string" + Name = "String" } }); writer.Write(method); @@ -1675,7 +1675,7 @@ public void WritesGetterToBackingStoreWithNonnullProperty() parentClass.GetGreatestGrandparent().AddBackingStoreProperty(); method.AccessedProperty.Type = new CodeType { - Name = "string", + Name = "String", IsNullable = false, }; var defaultValue = "someDefaultValue"; @@ -1750,7 +1750,7 @@ public void WritesConstructor() Kind = CodePropertyKind.Custom, Type = new CodeType { - Name = "string" + Name = "String" } }); AddRequestProperties(); @@ -1765,7 +1765,7 @@ public void WritesConstructor() }); writer.Write(method); var result = tw.ToString(); - Assert.Contains(parentClass.Name.ToFirstCharacterUpperCase(), result); + Assert.Contains(parentClass.Name, result); Assert.Contains($"this.set{propName.ToFirstCharacterUpperCase()}({defaultValue})", result); Assert.Contains("super", result); } @@ -1781,14 +1781,14 @@ public void WritesWithUrl() Kind = CodeParameterKind.RawUrl, Type = new CodeType { - Name = "string" + Name = "String" }, }); Assert.Throws(() => writer.Write(method)); AddRequestProperties(); writer.Write(method); var result = tw.ToString(); - Assert.Contains($"return new {parentClass.Name.ToFirstCharacterUpperCase()}", result); + Assert.Contains($"return new {parentClass.Name}", result); } [Fact] public void DoesNotWriteConstructorWithDefaultFromComposedType() @@ -1819,7 +1819,7 @@ public void DoesNotWriteConstructorWithDefaultFromComposedType() }); var sType = new CodeType { - Name = "string", + Name = "String", }; var arrayType = new CodeType { @@ -1830,7 +1830,7 @@ public void DoesNotWriteConstructorWithDefaultFromComposedType() writer.Write(method); var result = tw.ToString(); - Assert.Contains(parentClass.Name.ToFirstCharacterUpperCase(), result); + Assert.Contains(parentClass.Name, result); Assert.DoesNotContain(defaultValue, result);//ensure the composed type is not referenced } [Fact] @@ -1848,7 +1848,7 @@ public void WritesRawUrlConstructor() Kind = CodePropertyKind.Custom, Type = new CodeType { - Name = "string" + Name = "String" } }); AddRequestProperties(); @@ -1858,12 +1858,12 @@ public void WritesRawUrlConstructor() Kind = CodeParameterKind.RawUrl, Type = new CodeType { - Name = "string" + Name = "String" } }); writer.Write(method); var result = tw.ToString(); - Assert.Contains(parentClass.Name.ToFirstCharacterUpperCase(), result); + Assert.Contains(parentClass.Name, result); Assert.Contains($"this.set{propName.ToFirstCharacterUpperCase()}({defaultValue})", result); Assert.Contains("super", result); } @@ -1903,7 +1903,7 @@ public void WritesApiConstructor() method.SerializerModules = new() { "com.microsoft.kiota.serialization.Serializer" }; writer.Write(method); var result = tw.ToString(); - Assert.Contains(parentClass.Name.ToFirstCharacterUpperCase(), result); + Assert.Contains(parentClass.Name, result); Assert.Contains("registerDefaultSerializer", result); Assert.Contains("registerDefaultDeserializer", result); Assert.Contains($"put(\"baseurl\", core.getBaseUrl())", result); @@ -1959,7 +1959,7 @@ public async Task AccessorsTargetingEscapedPropertiesAreNotEscapedThemselves() model.AddProperty(new CodeProperty { Name = "short", - Type = new CodeType { Name = "string" }, + Type = new CodeType { Name = "String" }, Access = AccessModifier.Public, Kind = CodePropertyKind.Custom, }); @@ -1988,16 +1988,16 @@ public void DoesntWriteReadOnlyPropertiesInSerializerBody() AddSerializationProperties(); parentClass.AddProperty(new CodeProperty { - Name = "ReadOnlyProperty", + Name = "readOnlyProperty", ReadOnly = true, Type = new CodeType { - Name = "string", + Name = "String", }, }); writer.Write(method); var result = tw.ToString(); - Assert.DoesNotContain("ReadOnlyProperty", result); + Assert.DoesNotContain("readOnlyProperty", result); AssertExtensions.CurlyBracesAreClosed(result); } [Fact]