@@ -143,19 +143,30 @@ public async void GetProductsColumnTypesSerializationAsyncEnumerableTest(string
143143 this . StartFunctionHost ( nameof ( GetProductsColumnTypesSerializationAsyncEnumerable ) , lang , true ) ;
144144
145145 string datetime = "2022-10-20 12:39:13.123" ;
146- ProductColumnTypes [ ] expectedResponse = new [ ]
147- {
148- new ProductColumnTypes ( )
149- {
150- ProductId = 999 ,
151- Datetime = DateTime . Parse ( datetime ) ,
152- Datetime2 = DateTime . Parse ( datetime )
153- }
154- } ;
146+ ProductColumnTypes [ ] expectedResponse = JsonConvert . DeserializeObject < ProductColumnTypes [ ] > ( "[{\" ProductId\" :999,\" BigInt\" :999,\" Bit\" :false,\" DecimalType\" :1.2345,\" Money\" :1.2345,\" Numeric\" :1.2345,\" SmallInt\" :1,\" SmallMoney\" :1.2345,\" TinyInt\" :1,\" FloatType\" :0.1,\" Real\" :0.1,\" Date\" :\" 2022-10-20T00:00:00.000Z\" ,\" Datetime\" :\" 2022-10-20T12:39:13.123Z\" ,\" Datetime2\" :\" 2022-10-20T12:39:13.123Z\" ,\" DatetimeOffset\" :\" 2022-10-20T12:39:13.123Z\" ,\" SmallDatetime\" :\" 2022-10-20T12:39:00.000Z\" ,\" Time\" :\" 12:39:13.1230000\" ,\" CharType\" :\" test\" ,\" Varchar\" :\" test\" ,\" Nchar\" :\" \uFFFD \u0020 \u0020 \u0020 \" ,\" Nvarchar\" :\" \uFFFD \" }]" ) ;
147+
155148 this . ExecuteNonQuery ( "INSERT INTO [dbo].[ProductsColumnTypes] VALUES (" +
156- "999, " + // ProductId
157- $ "CONVERT(DATETIME, '{ datetime } '), " + // Datetime field
158- $ "CONVERT(DATETIME2, '{ datetime } '))") ; // Datetime2 field
149+ "999, " + // ProductId,
150+ "999, " + // BigInt
151+ "0, " + // Bit
152+ "1.2345, " + // DecimalType
153+ "1.2345, " + // Money
154+ "1.2345, " + // Numeric
155+ "1, " + // SmallInt
156+ "1.2345, " + // SmallMoney
157+ "1, " + // TinyInt
158+ ".1, " + // FloatType
159+ ".1, " + // Real
160+ $ "CONVERT(DATE, '{ datetime } '), " + // Date
161+ $ "CONVERT(DATETIME, '{ datetime } '), " + // Datetime
162+ $ "CONVERT(DATETIME2, '{ datetime } '), " + // Datetime2
163+ $ "CONVERT(DATETIMEOFFSET, '{ datetime } '), " + // DatetimeOffset
164+ $ "CONVERT(SMALLDATETIME, '{ datetime } '), " + // SmallDatetime
165+ $ "CONVERT(TIME, '{ datetime } '), " + // Time
166+ "'test', " + // CharType
167+ "'test', " + // Varchar
168+ "NCHAR(0xD84C), " + // Nchar
169+ "NCHAR(0xD84C))" ) ; // Nvarchar
159170
160171 HttpResponseMessage response = await this . SendInputRequest ( "getproducts-columntypesserializationasyncenumerable" , $ "?culture={ culture } ") ;
161172 // We expect the datetime and datetime2 fields to be returned in UTC format
@@ -175,13 +186,31 @@ public async void GetProductsColumnTypesSerializationTest(SupportedLanguages lan
175186
176187 string datetime = "2022-10-20 12:39:13.123" ;
177188 this . ExecuteNonQuery ( "INSERT INTO [dbo].[ProductsColumnTypes] VALUES (" +
178- "999, " + // ProductId
179- $ "CONVERT(DATETIME, '{ datetime } '), " + // Datetime field
180- $ "CONVERT(DATETIME2, '{ datetime } '))") ; // Datetime2 field
189+ "999, " + // ProductId,
190+ "999, " + // BigInt
191+ "0, " + // Bit
192+ "1.2345, " + // DecimalType
193+ "1.2345, " + // Money
194+ "1.2345, " + // Numeric
195+ "1, " + // SmallInt
196+ "1.2345, " + // SmallMoney
197+ "1, " + // TinyInt
198+ ".1, " + // FloatType
199+ ".1, " + // Real
200+ $ "CONVERT(DATE, '{ datetime } '), " + // Date
201+ $ "CONVERT(DATETIME, '{ datetime } '), " + // Datetime
202+ $ "CONVERT(DATETIME2, '{ datetime } '), " + // Datetime2
203+ $ "CONVERT(DATETIMEOFFSET, '{ datetime } '), " + // DatetimeOffset
204+ $ "CONVERT(SMALLDATETIME, '{ datetime } '), " + // SmallDatetime
205+ $ "CONVERT(TIME, '{ datetime } '), " + // Time
206+ "'test', " + // CharType
207+ "'test', " + // Varchar
208+ "NCHAR(0xD84C), " + // Nchar
209+ "NCHAR(0xD84C))" ) ; // Nvarchar
181210
182211 HttpResponseMessage response = await this . SendInputRequest ( "getproducts-columntypesserialization" ) ;
183- // We expect the datetime and datetime2 fields to be returned in UTC format
184- ProductColumnTypes [ ] expectedResponse = JsonConvert . DeserializeObject < ProductColumnTypes [ ] > ( "[{\" ProductId\" :999,\" Datetime\" :\" 2022-10-20T12:39:13.123Z\" ,\" Datetime2\" :\" 2022-10-20T12:39:13.123Z\" }]" ) ;
212+ // We expect the date fields to be returned in UTC format
213+ ProductColumnTypes [ ] expectedResponse = JsonConvert . DeserializeObject < ProductColumnTypes [ ] > ( "[{\" ProductId\" :999,\" BigInt \" :999, \" Bit \" :false, \" DecimalType \" :1.2345, \" Money \" :1.2345, \" Numeric \" :1.2345, \" SmallInt \" :1, \" SmallMoney \" :1.2345, \" TinyInt \" :1, \" FloatType \" :0.1, \" Real \" :0.1, \" Date \" : \" 2022-10-20T00:00:00.000Z \" , \" Datetime\" :\" 2022-10-20T12:39:13.123Z\" ,\" Datetime2\" :\" 2022-10-20T12:39:13.123Z\" , \" DatetimeOffset \" : \" 2022-10-20T12:39:13.123Z \" , \" SmallDatetime \" : \" 2022-10-20T12:39:00.000Z \" , \" Time \" : \" 12:39:13.1230000 \" , \" CharType \" : \" test \" , \" Varchar \" : \" test \" , \" Nchar \" : \" \uFFFD \u0020 \u0020 \u0020 \" , \" Nvarchar \" : \" \uFFFD \" }]" ) ;
185214 string actualResponse = await response . Content . ReadAsStringAsync ( ) ;
186215 ProductColumnTypes [ ] actualProductResponse = JsonConvert . DeserializeObject < ProductColumnTypes [ ] > ( actualResponse ) ;
187216
0 commit comments