コード例 #1
0
ファイル: ATinkerRead.cs プロジェクト: HL7/tinkar-cs
        public void PBToDTOSemanticVersion()
        {
            SemanticVersionDTO dtoStart = Misc.CreateSemanticVersionDTO;
            PBSemanticVersion  pb       = dtoStart.ToPBSemanticVersion();
            SemanticVersionDTO dtoEnd   = pb.ToSemanticVersion();

            Assert.True(dtoStart.CompareTo(dtoEnd) == 0);
        }
コード例 #2
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);
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
0
        public void SemanticVersionDTOCompareToTest()
        {
            {
                SemanticVersionDTO a = Misc.CreateSemanticVersionDTO;
                SemanticVersionDTO b = Misc.CreateSemanticVersionDTO;
                Assert.True(a.CompareTo(b) == 0);
            }

            {
                SemanticVersionDTO a = Misc.CreateSemanticVersionDTO;
                SemanticVersionDTO b = Misc.CreateSemanticVersionDTO
                                       with
                {
                    PublicId = new PublicId(Misc.g2, Misc.g2, Misc.g3, Misc.g4)
                };
                Assert.False(a.CompareTo(b) == 0);
            }

            {
                SemanticVersionDTO a = Misc.CreateSemanticVersionDTO;
                SemanticVersionDTO b = Misc.CreateSemanticVersionDTO
                                       with
                {
                    StampDTO = Misc.CreateStampDTO with {
                        StatusPublicId = new PublicId(Misc.g2)
                    }
                };
                Assert.False(a.CompareTo(b) == 0);
            }

            {
                SemanticVersionDTO a = Misc.CreateSemanticVersionDTO;
                SemanticVersionDTO b = Misc.CreateSemanticVersionDTO
                                       with
                {
                    Fields = new Object[] { 1, "abcdef" }.ToImmutableArray()
                };
                Assert.False(a.CompareTo(b) == 0);
            }
        }