Disassemble() public method

public Disassemble ( byte data ) : void
data byte
return void
示例#1
0
		public void DisassembleTest()
		{
			Hl7Disassembler disassembler = new Hl7Disassembler();

			string filePath = "Hl7DisassemblerTest-hl7-2.txt";

			byte[] data = null;
			using (StreamReader reader = new StreamReader(filePath))
			{
				string text = reader.ReadToEnd();
				data = Encoding.UTF8.GetBytes(text);
			}

			disassembler.Disassemble(data);

			Message message = disassembler.NextMessage();
			Assert.IsNotNull(message);

			Assert.IsNull(disassembler.NextMessage(), "Expected only one message from pipeline");

			XDocument document = XDocument.Load("Hl7DisassemblerTest-hl7.xml");
			message.RetrieveAs<XDocument>().Save("temp.xml");

			Assert.IsTrue(XNode.DeepEquals(document, message.RetrieveAs<XDocument>()));

			message.RetrieveAs<XDocument>().Save("temp.xml");
		}
示例#2
0
        public void DisassembleTest()
        {
            Hl7Disassembler disassembler = new Hl7Disassembler();

            string filePath = "Hl7DisassemblerTest-hl7-2.txt";

            byte[] data = null;
            using (StreamReader reader = new StreamReader(filePath))
            {
                string text = reader.ReadToEnd();
                data = Encoding.UTF8.GetBytes(text);
            }

            disassembler.Disassemble(data);

            Message message = disassembler.NextMessage();

            Assert.IsNotNull(message);

            Assert.IsNull(disassembler.NextMessage(), "Expected only one message from pipeline");

            XDocument document = XDocument.Load("Hl7DisassemblerTest-hl7.xml");

            message.RetrieveAs <XDocument>().Save("temp.xml");

            Assert.IsTrue(XNode.DeepEquals(document, message.RetrieveAs <XDocument>()));

            message.RetrieveAs <XDocument>().Save("temp.xml");
        }