@@ -48,6 +48,33 @@ public MultiCtor(int id, string name)
4848 this . Name = name ;
4949 }
5050 }
51+
52+ public class MultiCtorWithArray
53+ {
54+ public int Id { get ; set ; }
55+ public string [ ] StrArr { get ; set ; }
56+ public string Name { get ; set ; }
57+ public string DefinedOnlyInStrArray { get ; set ; }
58+
59+ public MultiCtorWithArray ( )
60+ {
61+ }
62+
63+ [ BsonCtor ]
64+ public MultiCtorWithArray ( int id , string [ ] strarr )
65+ {
66+ this . Id = id ;
67+ this . StrArr = strarr ;
68+ this . DefinedOnlyInStrArray = "changed" ;
69+ }
70+
71+ public MultiCtorWithArray ( int id , string [ ] strarr , string name )
72+ {
73+ this . Id = id ;
74+ this . StrArr = strarr ;
75+ this . Name = name ;
76+ }
77+ }
5178
5279 public class MyClass
5380 {
@@ -109,6 +136,19 @@ public void BsonCtor_Attribute()
109136 obj . Name . Should ( ) . Be ( "value-name" ) ;
110137 obj . DefinedOnlyInInt32 . Should ( ) . Be ( "changed" ) ;
111138 }
139+
140+ [ Fact ]
141+ public void BsonCtorWithArray_Attribute ( )
142+ {
143+ var doc = new BsonDocument { [ "_id" ] = 25 , [ "name" ] = "value-name" , [ "strarr" ] = new BsonArray ( ) { "foo" , "bar" } } ;
144+
145+ var obj = _mapper . ToObject < MultiCtorWithArray > ( doc ) ;
146+
147+ obj . Id . Should ( ) . Be ( 25 ) ;
148+ obj . Name . Should ( ) . Be ( "value-name" ) ;
149+ string . Join ( ", " , obj . StrArr ) . Should ( ) . Be ( "foo, bar" ) ;
150+ obj . DefinedOnlyInStrArray . Should ( ) . Be ( "changed" ) ;
151+ }
112152
113153 [ Fact ]
114154 public void Custom_Ctor_Non_Simple_Types ( )
0 commit comments