@@ -554,7 +554,9 @@ PRIMARY KEY (Int32Column)
554554 YdbDbType . Interval ,
555555 new List < TimeSpan ? > { TimeSpan . FromDays ( 1 ) , TimeSpan . FromDays ( 2 ) , TimeSpan . FromDays ( 3 ) , null }
556556 } ,
557- { YdbDbType . Interval , ( TimeSpan ? [ ] ) [ TimeSpan . FromDays ( 1 ) , TimeSpan . FromDays ( 2 ) , TimeSpan . FromDays ( 3 ) , null ] }
557+ { YdbDbType . Interval , ( TimeSpan ? [ ] ) [ TimeSpan . FromDays ( 1 ) , TimeSpan . FromDays ( 2 ) , TimeSpan . FromDays ( 3 ) , null ] } ,
558+ { YdbDbType . Int64 , new List < object > { 1 , 2u , ( byte ) 3 } } ,
559+ { YdbDbType . Int64 , new object [ ] { 1 , 2u , ( byte ) 3 } } // only not null objects
558560 } ;
559561
560562 public static TheoryData < YdbDbType , IList > ExtraParams = new ( )
@@ -740,13 +742,37 @@ public async Task YdbParameter_Value_WithYdbDbTypeList_ProducesListOfSpecifiedTy
740742 public void YdbParameter_SetValue_ListOrArray_InvalidInputs_Throws ( )
741743 {
742744 Assert . Equal ( "Writing value of 'System.Object[]' is not supported for parameters having YdbDbType 'List<Bool>'" ,
743- Assert . Throws < InvalidOperationException > ( ( ) =>
744- new YdbParameter ( "list" , YdbDbType . List | YdbDbType . Bool , new object [ ] { true , false , "string" } )
745- . TypedValue ) . Message ) ;
745+ Assert . Throws < InvalidOperationException > ( ( ) => new YdbParameter ( "list" ,
746+ YdbDbType . List | YdbDbType . Bool , new object [ ] { true , false , "string" } ) . TypedValue ) . Message ) ;
746747
747748 Assert . Equal (
748749 "Writing value of 'System.Object[]' is not supported for parameters having YdbDbType 'List<Decimal>'" ,
749750 Assert . Throws < InvalidOperationException > ( ( ) => new YdbParameter ( "list" ,
750751 YdbDbType . List | YdbDbType . Decimal , new object [ ] { 1.0m , false , 2.0m } ) . TypedValue ) . Message ) ;
752+
753+ Assert . Equal ( "All elements in the list must have the same type. Expected: { \" typeId\" : \" INT32\" }, " +
754+ "actual: { \" typeId\" : \" UINT32\" }" , Assert . Throws < ArgumentException > ( ( ) =>
755+ new YdbParameter ( "list" , new List < object > { 1 , 2u , ( byte ) 3 } ) . TypedValue ) . Message ) ;
756+
757+ Assert . Equal ( "All elements in the list must have the same type. Expected: { \" typeId\" : \" INT32\" }, " +
758+ "actual: { \" typeId\" : \" UINT32\" }" , Assert . Throws < ArgumentException > ( ( ) =>
759+ new YdbParameter ( "list" , new object [ ] { 1 , 2u , ( byte ) 3 } ) . TypedValue ) . Message ) ;
760+
761+ Assert . Equal ( "Collection of type 'System.Collections.Generic.List`1[System.Object]' contains null. " +
762+ "Specify YdbDbType (e.g. YdbDbType.List | YdbDbType.<T>) " +
763+ "or use a strongly-typed collection (e.g., List<T?>)." , Assert . Throws < ArgumentException > ( ( ) =>
764+ new YdbParameter ( "list" , new List < object ? > { 1 , null } ) . TypedValue ) . Message ) ;
765+
766+ Assert . Equal ( "Collection of type 'System.Object[]' contains null. " +
767+ "Specify YdbDbType (e.g. YdbDbType.List | YdbDbType.<T>) " +
768+ "or use a strongly-typed collection (e.g., List<T?>)." , Assert . Throws < ArgumentException > ( ( ) =>
769+ new YdbParameter ( "list" , new object ? [ ] { 1 , null } ) . TypedValue ) . Message ) ;
751770 }
771+
772+ [ Fact ]
773+ public void YdbParameter_SetYdbDbTypeList_Throws ( ) =>
774+ Assert . Equal ( "Cannot set YdbDbType to just List. " +
775+ "Use Binary-Or with the element type (e.g. Array of dates is YdbDbType.List | YdbDbType.Date). " +
776+ "(Parameter 'value')" ,
777+ Assert . Throws < ArgumentOutOfRangeException > ( ( ) => new YdbParameter ( "list" , YdbDbType . List ) ) . Message ) ;
752778}
0 commit comments