示例#1
0
                public override void DoTests()
                {
                    Unmarshaller unmarshaller = new Unmarshaller("string1;string2;");

                    AssertEqual(unmarshaller._storage.Count(), 2, "Wrong number of strings unmarshalled");
                    AssertEqual(unmarshaller._index, 0, "Wrong initial index");
                    AssertEqual(unmarshaller.UnmarshallString(), "string1", "Wrong first string unmarshalling");
                    AssertEqual(unmarshaller._index, 1, "Wrong updated index");
                    AssertEqual(unmarshaller.UnmarshallString(), "string2", "Wrong second string unmarshalling");
                    AssertEqual(unmarshaller.UnmarshallString(), "", "Wrong default string unmarshalling");
                    unmarshaller = new Unmarshaller("1;");
                    AssertEqual(unmarshaller._storage.Count(), 1, "Wrong number of int unmarshalled");
                    AssertEqual(unmarshaller.UnmarshallInt(), 1, "Wrong int unmarshalling");
                    AssertEqual(unmarshaller.UnmarshallInt(), 0, "Wrong default int unmarshalling");
                    unmarshaller = new Unmarshaller("1000;");
                    AssertEqual(unmarshaller._storage.Count(), 1, "Wrong number of double unmarshalled");
                    AssertEqual(unmarshaller.UnmarshallDouble(), 1000, "Wrong double unmarshalling");
                    AssertEqual(unmarshaller.UnmarshallDouble(), 0, "Wrong default double unmarshalling");
                }