@@ -6,36 +6,28 @@ This Source Code Form is subject to the terms of the Mozilla Public
66
77using System . Collections . Generic ;
88using Microsoft . VisualStudio . TestTools . UnitTesting ;
9- using PhpSerializerNET . Test . DataTypes ;
109
11- namespace PhpSerializerNET . Test {
10+ namespace PhpSerializerNET . Test . Serialize {
1211 [ TestClass ]
13- public class SerializeObjects {
12+ public class ListSerializationTest {
1413 [ TestMethod ]
15- public void ExplicitToClassWithMappingAttributes ( ) {
16- var testObject = new MappedClass ( ) {
17- English = "Hello world!" ,
18- German = "Hallo Welt!" ,
19- It = "Ciao mondo!"
20- } ;
21-
22- Assert . AreEqual (
23- "a:3:{s:2:\" en\" ;s:12:\" Hello world!\" ;s:2:\" de\" ;s:11:\" Hallo Welt!\" ;s:4:\" Guid\" ;a:1:{s:5:\" Empty\" ;N;}}" ,
24- PhpSerialization . Serialize ( testObject )
25- ) ;
26- }
27-
28-
29- [ TestMethod ]
30- public void SerializeList ( ) {
14+ public void SerializeListOfStrings ( ) {
3115 Assert . AreEqual ( // strings:
3216 "a:2:{i:0;s:5:\" Hello\" ;i:1;s:5:\" World\" ;}" ,
3317 PhpSerialization . Serialize ( new List < string > ( ) { "Hello" , "World" } )
3418 ) ;
19+ }
20+
21+ [ TestMethod ]
22+ public void SerializeListOfBools ( ) {
3523 Assert . AreEqual ( // booleans:
3624 "a:2:{i:0;b:1;i:1;b:0;}" ,
3725 PhpSerialization . Serialize ( new List < object > ( ) { true , false } )
3826 ) ;
27+ }
28+
29+ [ TestMethod ]
30+ public void SerializeMixedList ( ) {
3931 Assert . AreEqual ( // mixed types:
4032 "a:5:{i:0;b:1;i:1;i:1;i:2;d:1.23;i:3;s:3:\" end\" ;i:4;N;}" ,
4133 PhpSerialization . Serialize ( new List < object > ( ) { true , 1 , 1.23 , "end" , null } )
0 commit comments