@@ -6,36 +6,28 @@ This Source Code Form is subject to the terms of the Mozilla Public
6
6
7
7
using System . Collections . Generic ;
8
8
using Microsoft . VisualStudio . TestTools . UnitTesting ;
9
- using PhpSerializerNET . Test . DataTypes ;
10
9
11
- namespace PhpSerializerNET . Test {
10
+ namespace PhpSerializerNET . Test . Serialize {
12
11
[ TestClass ]
13
- public class SerializeObjects {
12
+ public class ListSerializationTest {
14
13
[ 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 ( ) {
31
15
Assert . AreEqual ( // strings:
32
16
"a:2:{i:0;s:5:\" Hello\" ;i:1;s:5:\" World\" ;}" ,
33
17
PhpSerialization . Serialize ( new List < string > ( ) { "Hello" , "World" } )
34
18
) ;
19
+ }
20
+
21
+ [ TestMethod ]
22
+ public void SerializeListOfBools ( ) {
35
23
Assert . AreEqual ( // booleans:
36
24
"a:2:{i:0;b:1;i:1;b:0;}" ,
37
25
PhpSerialization . Serialize ( new List < object > ( ) { true , false } )
38
26
) ;
27
+ }
28
+
29
+ [ TestMethod ]
30
+ public void SerializeMixedList ( ) {
39
31
Assert . AreEqual ( // mixed types:
40
32
"a:5:{i:0;b:1;i:1;i:1;i:2;d:1.23;i:3;s:3:\" end\" ;i:4;N;}" ,
41
33
PhpSerialization . Serialize ( new List < object > ( ) { true , 1 , 1.23 , "end" , null } )
0 commit comments