Skip to content

Commit 5d357e9

Browse files
committed
good tests
1 parent 98d71f9 commit 5d357e9

File tree

4 files changed

+60
-15
lines changed

4 files changed

+60
-15
lines changed

DemoCoreWeb.ClientApiTextJson/WebApiClientTextJsonAuto.cs

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4293,6 +4293,7 @@ public decimal GetDecimalSquare(decimal d, Action<System.Net.Http.Headers.HttpRe
42934293
/// <summary>
42944294
/// GET api/SuperDemo/DecimalZero
42954295
/// </summary>
4296+
[System.ObsoleteAttribute("Just for test", DiagnosticId="abc", UrlFormat="efg")]
42964297
public async Task<decimal> GetDecimalZeroAsync(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
42974298
{
42984299
var requestUri = "api/SuperDemo/DecimalZero";
@@ -4314,6 +4315,7 @@ public async Task<decimal> GetDecimalZeroAsync(Action<System.Net.Http.Headers.Ht
43144315
/// <summary>
43154316
/// GET api/SuperDemo/DecimalZero
43164317
/// </summary>
4318+
[System.ObsoleteAttribute("Just for test", DiagnosticId="abc", UrlFormat="efg")]
43174319
public decimal GetDecimalZero(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
43184320
{
43194321
var requestUri = "api/SuperDemo/DecimalZero";
@@ -4506,6 +4508,7 @@ public double Getdouble(Action<System.Net.Http.Headers.HttpRequestHeaders> handl
45064508
/// Result of 0.1d + 0.2d - 0.3d
45074509
/// GET api/SuperDemo/DoubleZero
45084510
/// </summary>
4511+
[System.ObsoleteAttribute("for testing")]
45094512
public async Task<double> GetDoubleZeroAsync(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
45104513
{
45114514
var requestUri = "api/SuperDemo/DoubleZero";
@@ -4528,6 +4531,7 @@ public async Task<double> GetDoubleZeroAsync(Action<System.Net.Http.Headers.Http
45284531
/// Result of 0.1d + 0.2d - 0.3d
45294532
/// GET api/SuperDemo/DoubleZero
45304533
/// </summary>
4534+
[System.ObsoleteAttribute("for testing")]
45314535
public double GetDoubleZero(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
45324536
{
45334537
var requestUri = "api/SuperDemo/DoubleZero";
@@ -4639,6 +4643,7 @@ public System.DayOfWeek[] GetEnumArrayQ2(System.Collections.Generic.List<System.
46394643
/// <summary>
46404644
/// GET api/SuperDemo/FloatZero
46414645
/// </summary>
4646+
[System.ObsoleteAttribute()]
46424647
public async Task<float> GetFloatZeroAsync(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
46434648
{
46444649
var requestUri = "api/SuperDemo/FloatZero";
@@ -4660,6 +4665,7 @@ public async Task<float> GetFloatZeroAsync(Action<System.Net.Http.Headers.HttpRe
46604665
/// <summary>
46614666
/// GET api/SuperDemo/FloatZero
46624667
/// </summary>
4668+
[System.ObsoleteAttribute()]
46634669
public float GetFloatZero(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
46644670
{
46654671
var requestUri = "api/SuperDemo/FloatZero";
@@ -8644,19 +8650,9 @@ public class BigNumbers : object
86448650

86458651
[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
86468652
[System.SerializableAttribute()]
8647-
public class Company : DemoWebApi.DemoData.Base.Client.Entity
8653+
public class BizEntity : DemoWebApi.DemoData.Base.Client.Entity
86488654
{
86498655

8650-
/// <summary>
8651-
/// BusinessNumber to be serialized as BusinessNum
8652-
/// </summary>
8653-
[System.Runtime.Serialization.DataMember(Name="business_no")]
8654-
[System.Text.Json.Serialization.JsonPropertyName("business_no")]
8655-
public string BusinessNumber { get; set; }
8656-
8657-
[System.Runtime.Serialization.DataMember()]
8658-
public string BusinessNumberType { get; set; }
8659-
86608656
/// <summary>
86618657
/// Data type: Date
86628658
/// </summary>
@@ -8666,7 +8662,24 @@ public class Company : DemoWebApi.DemoData.Base.Client.Entity
86668662

86678663
[System.Runtime.Serialization.DataMember()]
86688664
public System.DateOnly RegisterDate { get; set; }
8665+
}
8666+
8667+
[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
8668+
[System.SerializableAttribute()]
8669+
public class Company : DemoWebApi.DemoData.Client.BizEntity
8670+
{
8671+
8672+
/// <summary>
8673+
/// BusinessNumber to be serialized as BusinessNum
8674+
/// </summary>
8675+
[System.Runtime.Serialization.DataMember(Name="business_no")]
8676+
[System.Text.Json.Serialization.JsonPropertyName("business_no")]
8677+
public string BusinessNumber { get; set; }
86698678

8679+
[System.Runtime.Serialization.DataMember()]
8680+
public string BusinessNumberType { get; set; }
8681+
8682+
[System.ObsoleteAttribute()]
86708683
[System.Runtime.Serialization.DataMember()]
86718684
public string[][] TextMatrix { get; set; }
86728685

@@ -8803,6 +8816,7 @@ public enum MedicalContraindiationResponseTypeTypeCode
88038816
T,
88048817
}
88058818

8819+
[System.ObsoleteAttribute("Type deprecated for testing")]
88068820
[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
88078821
[System.SerializableAttribute()]
88088822
public class MimsPackage : object
@@ -8834,6 +8848,18 @@ public class MimsPackage : object
88348848

88358849
[System.Runtime.Serialization.DataMember()]
88368850
public string Tag { get; set; }
8851+
8852+
[System.ObsoleteAttribute("Just for testing", true)]
8853+
[System.Runtime.Serialization.DataMember()]
8854+
public string TagForTest { get; set; }
8855+
8856+
[System.ObsoleteAttribute("Just for testing", DiagnosticId="someId", UrlFormat="WhateverFormat")]
8857+
[System.Runtime.Serialization.DataMember()]
8858+
public string TagForTest2 { get; set; }
8859+
8860+
[System.ObsoleteAttribute("Just for testing", true, DiagnosticId="someId", UrlFormat="WhateverFormat")]
8861+
[System.Runtime.Serialization.DataMember()]
8862+
public string TagForTest3 { get; set; }
88378863
}
88388864

88398865
[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
@@ -8970,6 +8996,19 @@ public enum PhoneType
89708996
Fax,
89718997
}
89728998
}
8999+
namespace DemoWebApi.DemoDataEx.Client
9000+
{
9001+
9002+
9003+
[System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")]
9004+
[System.SerializableAttribute()]
9005+
public class Trust : DemoWebApi.DemoData.Client.BizEntity
9006+
{
9007+
9008+
[System.Runtime.Serialization.DataMember()]
9009+
public string Trustee { get; set; }
9010+
}
9011+
}
89739012
namespace DemoWebApi.Models.Client
89749013
{
89759014

DemoTextJsonWeb/CodeGen.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
"CherryPickingMethods": 3
1313
},
1414

15+
{
16+
"AssemblyName": "DemoWebApiDemoDataEx",
17+
"CherryPickingMethods": 1
18+
},
19+
1520
{
1621
"AssemblyName": "DemoCoreWebControllers",
1722
"CherryPickingMethods": 3

DemoTextJsonWeb/DemoTextJsonWeb.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
<ItemGroup>
2020
<ProjectReference Include="..\DemoCoreWebControllers\DemoCoreWebControllers.csproj" />
21+
<ProjectReference Include="..\DemoWebApiDemoDataEx\DemoWebApiDemoDataEx.csproj" />
2122
<ProjectReference Include="..\Fonlow.DateOnlyExtensionsNet\Fonlow.DateOnlyExtensionsTextJson.csproj" />
2223
<ProjectReference Include="..\Fonlow.IntegralExtensionsTextJson\Fonlow.IntegralExtensionsTextJson.csproj" />
2324
<ProjectReference Include="..\WebApiClientGenCore.Abstract\WebApiClientGenCore.Abstract.csproj" />

WebApiClientGenCore.Abstract/Poco2CsGen.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public Poco2CsGen(CodeCompileUnit codeCompileUnit, CodeDomProvider csharpCodeDom
7575
/// <returns>CodeDOM namespaces containing POCO classes.</returns>
7676
public void CreateCodeDomForAssembly(Assembly assembly, CherryPickingMethods cherryPickingMethods, bool? dataAnnotationsToComments)
7777
{
78-
string xmlDocFileName = DocComment.DocCommentLookup.GetXmlPath(assembly);
79-
docLookup = Fonlow.DocComment.DocCommentLookup.Create(xmlDocFileName);
78+
string xmlDocFileName = DocCommentLookup.GetXmlPath(assembly);
79+
docLookup = DocCommentLookup.Create(xmlDocFileName);
8080
this.dataAnnotationsToComments = dataAnnotationsToComments;
8181
Type[] cherryTypes = PodGenHelper.GetCherryTypes(assembly, cherryPickingMethods);
8282
CreateCodeDomForTypes(cherryTypes, cherryPickingMethods);
@@ -124,7 +124,7 @@ public CodeTypeReference TranslateToClientTypeReference(Type type)
124124
if (type.FullName == "System.Net.Http.HttpResponseMessage")
125125
return new CodeTypeReference("System.Net.Http.HttpResponseMessage");
126126

127-
if (type.FullName == "System.Object" && (type.Attributes & System.Reflection.TypeAttributes.Serializable) == System.Reflection.TypeAttributes.Serializable)
127+
if (type.FullName == "System.Object")// && (type.Attributes & TypeAttributes.Serializable) == TypeAttributes.Serializable)
128128
return codeGenOutputsSettings.UseSystemTextJson ? new CodeTypeReference("System.Text.Json.Nodes.JsonObject") : new CodeTypeReference("Newtonsoft.Json.Linq.JObject"); // possible only after .NET 6
129129
}
130130

@@ -782,7 +782,7 @@ public string TranslateToClientTypeReferenceText(Type type, bool forDocComment)
782782
if (type.FullName == "System.Net.Http.HttpResponseMessage")
783783
return "System.Net.Http.HttpResponseMessage";
784784

785-
if (type.FullName == "System.Object" && (type.Attributes & System.Reflection.TypeAttributes.Serializable) == System.Reflection.TypeAttributes.Serializable)
785+
if (type.FullName == "System.Object" && (type.Attributes & TypeAttributes.Serializable) == TypeAttributes.Serializable)
786786
return codeGenOutputsSettings.UseSystemTextJson ? "System.Text.Json.Nodes.JsonObject" : "Newtonsoft.Json.Linq.JObject";
787787
}
788788

0 commit comments

Comments
 (0)