Пример #1
0
        public void SemanticVersionDTOMarshalTest()
        {
            SemanticVersionDTO dtoStart = Misc.CreateSemanticVersionDTO;

            MemoryStream ms = new MemoryStream();

            using (TinkarOutput output = new TinkarOutput(ms))
            {
                dtoStart.Marshal(output);
            }

            ms.Position = 0;
            using (TinkarInput input = new TinkarInput(ms))
            {
                SemanticVersionDTO dtoRead = SemanticVersionDTO.Make(input,
                                                                     dtoStart.PublicId);
                Assert.True(dtoStart.CompareTo(dtoRead) == 0);
            }
        }
Пример #2
0
        public void SemanticVersionDTOJsonMarshal()
        {
            SemanticVersionDTO dtoStart = Misc.CreateSemanticVersionDTO;
            MemoryStream       ms       = new MemoryStream();

            using (TinkarJsonOutput output = new TinkarJsonOutput(ms, true))
            {
                dtoStart.Marshal(output);
            }

            ms.Dump();
            ms.Position = 0;
            using (TinkarJsonInput input = new TinkarJsonInput(ms))
            {
                SemanticVersionDTO dtoEnd = SemanticVersionDTO.Make(
                    input.ReadJsonObject(),
                    dtoStart.PublicId
                    );
                Assert.True(dtoStart.CompareTo(dtoEnd) == 0);
            }
        }