Skip to content

Commit 2825393

Browse files
committed
Fix non-zero lower-bounds test for Silverlight because they never success because of lack of lower-bounds setting in Silverlight.
1 parent 0ea072d commit 2825393

13 files changed

+234
-0
lines changed

test/MsgPack.UnitTest.CodeDom/Serialization/ArrayCodeDomBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest.CodeDom/Serialization/MapCodeDomBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/ArrayContextBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/ArrayExpressionBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/ArrayFieldBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/ArrayGenerationBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,10 +697,21 @@ public void TestNonZeroBoundArray()
697697
stream.Position = 0;
698698

699699
var result = ( Array )serializer.Unpack( stream );
700+
#if !SILVERLIGHT
700701
Assert.That( result, Is.TypeOf( array.GetType() ) );
702+
#else
703+
// Silverlight does not support lower bound settings, so sz array will return.
704+
Assert.That( result, Is.TypeOf<int[]>() );
705+
#endif // !SILVERLIGHT
701706
Assert.That( result.Rank, Is.EqualTo( 1 ) );
707+
#if !SILVERLIGHT
702708
Assert.That( result.Length, Is.EqualTo( 2 ) );
703709
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
710+
#else
711+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
712+
Assert.That( result.Length, Is.EqualTo( 3 ) );
713+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
714+
#endif // !SILVERLIGHT
704715
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
705716
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
706717
}
@@ -724,9 +735,16 @@ public void TestNonZeroBoundMultidimensionalArray()
724735
var result = ( Array )serializer.Unpack( stream );
725736
Assert.That( result, Is.TypeOf( array.GetType() ) );
726737
Assert.That( result.Rank, Is.EqualTo( 2 ) );
738+
#if !SILVERLIGHT
727739
Assert.That( result.Length, Is.EqualTo( 4 ) );
728740
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
729741
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
742+
#else
743+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
744+
Assert.That( result.Length, Is.EqualTo( 9 ) );
745+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
746+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
747+
#endif // !SILVERLIGHT
730748
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
731749
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
732750
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/ArrayReflectionBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/AutoMessagePackSerializerTest.ttinclude

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,10 +1167,21 @@ namespace MsgPack.Serialization
11671167
stream.Position = 0;
11681168

11691169
var result = ( Array )serializer.Unpack( stream );
1170+
#if !SILVERLIGHT
11701171
Assert.That( result, Is.TypeOf( array.GetType() ) );
1172+
#else
1173+
// Silverlight does not support lower bound settings, so sz array will return.
1174+
Assert.That( result, Is.TypeOf<int[]>() );
1175+
#endif // !SILVERLIGHT
11711176
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1177+
#if !SILVERLIGHT
11721178
Assert.That( result.Length, Is.EqualTo( 2 ) );
11731179
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1180+
#else
1181+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1182+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1183+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1184+
#endif // !SILVERLIGHT
11741185
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11751186
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11761187
}
@@ -1194,9 +1205,16 @@ namespace MsgPack.Serialization
11941205
var result = ( Array )serializer.Unpack( stream );
11951206
Assert.That( result, Is.TypeOf( array.GetType() ) );
11961207
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1208+
#if !SILVERLIGHT
11971209
Assert.That( result.Length, Is.EqualTo( 4 ) );
11981210
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11991211
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1212+
#else
1213+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1214+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1215+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1216+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1217+
#endif // !SILVERLIGHT
12001218
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
12011219
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
12021220
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/MapContextBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

test/MsgPack.UnitTest/Serialization/MapExpressionBasedAutoMessagePackSerializerTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,21 @@ public void TestNonZeroBoundArray()
11331133
stream.Position = 0;
11341134

11351135
var result = ( Array )serializer.Unpack( stream );
1136+
#if !SILVERLIGHT
11361137
Assert.That( result, Is.TypeOf( array.GetType() ) );
1138+
#else
1139+
// Silverlight does not support lower bound settings, so sz array will return.
1140+
Assert.That( result, Is.TypeOf<int[]>() );
1141+
#endif // !SILVERLIGHT
11371142
Assert.That( result.Rank, Is.EqualTo( 1 ) );
1143+
#if !SILVERLIGHT
11381144
Assert.That( result.Length, Is.EqualTo( 2 ) );
11391145
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
1146+
#else
1147+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1148+
Assert.That( result.Length, Is.EqualTo( 3 ) );
1149+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1150+
#endif // !SILVERLIGHT
11401151
Assert.That( result.GetValue( 1 ), Is.EqualTo( 1 ) );
11411152
Assert.That( result.GetValue( 2 ), Is.EqualTo( 2 ) );
11421153
}
@@ -1160,9 +1171,16 @@ public void TestNonZeroBoundMultidimensionalArray()
11601171
var result = ( Array )serializer.Unpack( stream );
11611172
Assert.That( result, Is.TypeOf( array.GetType() ) );
11621173
Assert.That( result.Rank, Is.EqualTo( 2 ) );
1174+
#if !SILVERLIGHT
11631175
Assert.That( result.Length, Is.EqualTo( 4 ) );
11641176
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 1 ) );
11651177
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 1 ) );
1178+
#else
1179+
// Silverlight does not support lower bound settings, so lowerBound + length will be set.
1180+
Assert.That( result.Length, Is.EqualTo( 9 ) );
1181+
Assert.That( result.GetLowerBound( 0 ), Is.EqualTo( 0 ) );
1182+
Assert.That( result.GetLowerBound( 1 ), Is.EqualTo( 0 ) );
1183+
#endif // !SILVERLIGHT
11661184
Assert.That( result.GetValue( 1, 1 ), Is.EqualTo( 11 ) );
11671185
Assert.That( result.GetValue( 1, 2 ), Is.EqualTo( 12 ) );
11681186
Assert.That( result.GetValue( 2, 1 ), Is.EqualTo( 21 ) );

0 commit comments

Comments
 (0)