Ejemplo n.º 1
0
        public void ComponentConstructorTest()
        {
            var target = Creator.Component(ComponentTestString);

            Assert.AreEqual("Cat&Mice&Dogs&Cats", target.AsString, "A test for Component Constructor");
            Assert.AreEqual("Cat\\T\\Mice&Dogs\\T\\Cats", target.AsStringRaw, "A test for Component Constructor");
        }
Ejemplo n.º 2
0
        public void CloneTest()
        {
            var target   = Creator.Component("Comp1&Sub1&Sub2\\T\\2");
            var expected = Creator.Component("Comp1&Sub1&Sub2\\T\\2");
            var actual   = target.Clone();

            Assert.AreEqual(expected.AsStringRaw, actual.AsStringRaw, "A test for Clone");
        }
Ejemplo n.º 3
0
        public void ContentCountTest()
        {
            var target = Creator.Component("Hello\\R\\World\\R\\Bye&SecondComponent");
            int actual;

            actual = target.ContentCount;
            Assert.AreEqual(5, target.ContentCount, "A test for ContentCount");
        }
Ejemplo n.º 4
0
        public void AddTest()
        {
            var target = Creator.Field("Field1^Field2^Field3^Field4");
            var item   = Creator.Component("Field5");

            target.Add(item);
            Assert.AreEqual("Field1^Field2^Field3^Field4^Field5", target.AsString, "A test for Add");
        }
Ejemplo n.º 5
0
        public void PathInformationTest()
        {
            var target = Creator.Component("one&two&three&four");

            Assert.AreEqual("<unk>-?", target.PathDetail.PathBrief, "A test for SubComponentList");
            Assert.AreEqual("<unk>-?.?.2", target.SubComponent(2).PathDetail.PathBrief, "A test for SubComponentList");
            Assert.AreEqual("<unk>-?.?.2 [0]", target.SubComponent(2).Content(0).PathDetail.PathBrief, "A test for SubComponentList");
        }
Ejemplo n.º 6
0
        public void ClearAllTest()
        {
            var target = Creator.Component("Comp1&Sub1&Sub2\\T\\2");

            target.ClearAll();
            Assert.AreEqual(String.Empty, target.AsStringRaw, "A test for ClearAll");
            Assert.AreEqual(true, target.IsEmpty, "A test for ClearAll");
        }
Ejemplo n.º 7
0
        public void ComponentConstructorTest1()
        {
            string StringRaw = "Cat%T%Mice!Dogs%T%Cats";
            var    target    = Creator.Component(StringRaw, CustomDelimiters);

            Assert.AreEqual("Cat!Mice!Dogs!Cats", target.AsString, "A test for Component Constructor 1");
            Assert.AreEqual("Cat%T%Mice!Dogs%T%Cats", target.AsStringRaw, "A test for Component Constructor 1");
        }
Ejemplo n.º 8
0
        public void AddTest2()
        {
            var target = Creator.Component("Comp1");
            var item   = Creator.Content(PeterPiper.Hl7.V2.Support.Standard.EscapeType.NewLine);

            target.Add(item);
            Assert.AreEqual("Comp1\\.br\\", target.AsStringRaw, "A test for Add 2");
        }
Ejemplo n.º 9
0
        public void RemoveSubComponentAtTest()
        {
            var target = Creator.Component("Hello!World!Bye", CustomDelimiters);
            int index  = 2; // TODO: Initialize to an appropriate value

            target.RemoveSubComponentAt(index);
            Assert.AreEqual("Hello!Bye", target.AsString, "A test for RemoveSubComponentAt");
        }
Ejemplo n.º 10
0
        public void RemoveContentAtTest()
        {
            var target = Creator.Component("Hello\\R\\World\\R\\Bye");
            int index  = 3; // TODO: Initialize to an appropriate value

            target.RemoveContentAt(index);
            Assert.AreEqual("Hello~WorldBye", target.AsString, "A test for RemoveContentAt");
        }
Ejemplo n.º 11
0
        public void SubComponentCountTest()
        {
            var target = Creator.Component("one&two&three&four");
            int actual;

            actual = target.SubComponentCount;
            Assert.AreEqual(4, actual, "A test for SubComponentCount");
        }
Ejemplo n.º 12
0
        public void AddTest1()
        {
            var target = Creator.Component("Comp1");
            var item   = Creator.SubComponent("Sub1");

            target.Add(item);
            Assert.AreEqual("Comp1&Sub1", target.AsStringRaw, "A test for Add 1");
        }
Ejemplo n.º 13
0
        public void InsertTest()
        {
            var target = Creator.Component("Hello&World&Bye");
            int index  = 2;
            var item   = Creator.SubComponent("Earth");

            target.Insert(index, item);
            Assert.AreEqual("Hello&Earth&World&Bye", target.AsStringRaw, "A test for Insert");
        }
Ejemplo n.º 14
0
        public void ToStringTest()
        {
            var    target   = Creator.Component("Hello\\R\\World\\R\\Bye&SecondComponent");
            string expected = "Hello~World~Bye&SecondComponent";
            string actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual, "A test for ToString");
        }
Ejemplo n.º 15
0
        public void SubComponentTest()
        {
            var target   = Creator.Component("Hello\\R\\World\\R\\Bye&SecondComponent");
            int index    = 2;
            var expected = Creator.SubComponent("SecondComponent");
            var actual   = target.SubComponent(index);

            Assert.AreEqual(expected.AsStringRaw, actual.AsStringRaw, "A test for SubComponent");
        }
Ejemplo n.º 16
0
        public void ComponentTest()
        {
            var Target   = Creator.Field("Sub1&Sub2&Sub3^Comp2\\H\\Comp2.2&Sub");
            int index    = 2; // TODO: Initialize to an appropriate value
            var expected = Creator.Component("Comp2\\H\\Comp2.2&Sub");
            var actual   = Target.Component(index);

            Assert.AreEqual(expected.AsStringRaw, actual.AsStringRaw, "A test for Component");
        }
Ejemplo n.º 17
0
        public void SetTest2()
        {
            var target = Creator.Field("\\H\\Cont1\\N\\Cont3\\.br\\newline&Sub2&Sub3&Sub4^Comp2^Comp3^Comp4");
            int index  = 3;
            var item   = Creator.Component("NewComp");

            target.Set(index, item);
            Assert.AreEqual("\\H\\Cont1\\N\\Cont3\\.br\\newline&Sub2&Sub3&Sub4^Comp2^NewComp^Comp4", target.AsStringRaw, "A test for Set 2");
        }
Ejemplo n.º 18
0
        public void InsertTest1()
        {
            var target = Creator.Component("Hello\\R\\World\\R\\Bye");
            int index  = 3;
            var item   = Creator.Content(PeterPiper.Hl7.V2.Support.Standard.EscapeType.Field);

            target.Insert(index, item);
            Assert.AreEqual("Hello~World|~Bye", target.AsString, "A test for Insert");
        }
Ejemplo n.º 19
0
        public void ContentTest()
        {
            var target   = Creator.Component("Hello \\T\\ World \\F\\ Bye");
            int index    = 3;
            var expected = Creator.Content(PeterPiper.Hl7.V2.Support.Standard.EscapeType.Field);
            var actual   = target.Content(index);

            Assert.AreEqual(expected.AsStringRaw, actual.AsStringRaw, "A test for Content");
        }
Ejemplo n.º 20
0
        public void ComponentConstructorTest2()
        {
            var target = Creator.Component();

            Assert.AreEqual(String.Empty, target.AsString, "A test for Component Constructor 2");
            Assert.AreEqual(true, target.IsEmpty, "A test for Component Constructor 2");
            Assert.AreEqual(String.Empty, target.SubComponent(1).AsStringRaw, "A test for Component Constructor 2");
            Assert.AreEqual(true, target.SubComponent(1).IsEmpty, "A test for Component Constructor 2");
        }
Ejemplo n.º 21
0
        public void AddTest1()
        {
            string StringRaw = "Hello \\T\\ World \\.br\\Earth&Sub2&Sub3^Comp2^Comp3~R2Hello \\T\\ World \\.br\\Earth&R2Sub2&R2Sub3^R2Comp2^R2Comp3~R3~R4";
            var    target    = Creator.Element(StringRaw);
            var    item      = Creator.Component("CompAdded");

            target.Add(item);
            Assert.AreEqual("Hello \\T\\ World \\.br\\Earth&Sub2&Sub3^Comp2^Comp3^CompAdded~R2Hello \\T\\ World \\.br\\Earth&R2Sub2&R2Sub3^R2Comp2^R2Comp3~R3~R4", target.AsStringRaw, "A test for Add");
            Assert.AreEqual(4, target.ComponentCount, "A test for Element Constructor 2");
        }
Ejemplo n.º 22
0
        public void AsStringRawTest()
        {
            var    target   = Creator.Component("Hello\\R\\World\\R\\Bye&SecondComponent");
            string expected = "Hello\\R\\World\\R\\Bye&SecondComponent";
            string actual;

            target.AsStringRaw = expected;
            actual             = target.AsStringRaw;
            Assert.AreEqual(expected, actual, "A test for ToStringRaw");
        }
Ejemplo n.º 23
0
        public void DelimterAccessTest()
        {
            var target = Creator.Component("o\\R\\ne&two&three&four");

            Assert.AreEqual('~', target.MessageDelimiters.Repeat, "A test for MessageDelimiters");
            Assert.AreEqual('|', target.MessageDelimiters.Field, "A test for MessageDelimiters");
            Assert.AreEqual('^', target.MessageDelimiters.Component, "A test for MessageDelimiters");
            Assert.AreEqual('&', target.MessageDelimiters.SubComponent, "A test for MessageDelimiters");
            Assert.AreEqual('\\', target.MessageDelimiters.Escape, "A test for MessageDelimiters");
        }
Ejemplo n.º 24
0
        public void InsertTest2()
        {
            string StringRaw = "Hello \\T\\ World \\.br\\Earth&Sub2&Sub3^Comp2^Comp3~R2Hello \\T\\ World \\.br\\Earth&R2Sub2&R2Sub3^R2Comp2^R2Comp3~R3~R4";
            var    target    = Creator.Element(StringRaw);
            int    index     = 2; //
            var    item      = Creator.Component("CompInserted");

            target.Insert(index, item);
            Assert.AreEqual("Hello \\T\\ World \\.br\\Earth&Sub2&Sub3^CompInserted^Comp2^Comp3~R2Hello \\T\\ World \\.br\\Earth&R2Sub2&R2Sub3^R2Comp2^R2Comp3~R3~R4", target.AsStringRaw, "A test for Insert 2");
        }
Ejemplo n.º 25
0
        public void IsEmptyTest()
        {
            var  target = Creator.Component(); // TODO: Initialize to an appropriate value
            bool actual;

            actual = target.IsEmpty;
            Assert.AreEqual(true, target.IsEmpty, "A test for IsEmpty");
            target.AsString = "Hello";
            Assert.AreEqual(false, target.IsEmpty, "A test for IsEmpty");
        }
Ejemplo n.º 26
0
        public void ComponentTest()
        {
            string StringRaw = "Hello \\T\\ World \\.br\\Earth&Sub2&Sub3^Comp2^Comp3~R2Hello \\T\\ World \\.br\\Earth&R2Sub2&R2Sub3^R2Comp2^R2Comp3~R3~R4";
            var    target    = Creator.Element(StringRaw);
            int    index     = 2;
            var    expected  = Creator.Component("Comp2");
            var    actual    = target.Component(index);

            Assert.AreEqual(expected.AsStringRaw, actual.AsStringRaw, "A test for Component");
        }
Ejemplo n.º 27
0
        public void IsHL7NullTest()
        {
            var  target = Creator.Component("\"\"");
            bool actual;

            actual = target.IsHL7Null;
            Assert.AreEqual(true, target.IsHL7Null, "A test for IsHL7Null");
            Assert.AreEqual(PeterPiper.Hl7.V2.Support.Standard.Null.HL7Null, target.AsString, "A test for IsHL7Null");
            target.AsString = "Hello";
            Assert.AreEqual(false, target.IsHL7Null, "A test for IsHL7Null");
        }
Ejemplo n.º 28
0
        public void SetTest1()
        {
            var target = Creator.Component("Hello\\R\\World\\R\\Bye&SecondComponent&ThirdComponent");
            int index  = 2;
            var item   = Creator.SubComponent("NewSub");
            var item2  = Creator.SubComponent("NewSub2");

            target.Set(index, item);
            Assert.AreEqual("NewSub", target.SubComponent(2).AsStringRaw, "A test for Set 2");
            target.Set(10, item2);
            Assert.AreEqual("NewSub2", target.SubComponent(10).AsStringRaw, "A test for Set 2");
        }
Ejemplo n.º 29
0
        public void SubComponentListTest()
        {
            var target = Creator.Component("one&two&three&four");
            ReadOnlyCollection <ISubComponent> actual;

            actual = target.SubComponentList;
            Assert.AreEqual(4, actual.Count, "A test for SubComponentList");
            Assert.AreEqual("one", actual[0].AsString, "A test for SubComponentList");
            Assert.AreEqual("two", actual[1].AsString, "A test for SubComponentList");
            Assert.AreEqual("three", actual[2].AsString, "A test for SubComponentList");
            Assert.AreEqual("four", actual[3].AsString, "A test for SubComponentList");
        }
Ejemplo n.º 30
0
        public void SetTest()
        {
            var target = Creator.Component("Hello\\R\\World\\R\\Bye&SecondComponent");
            int index  = 1;
            var item1  = Creator.Content(PeterPiper.Hl7.V2.Support.Standard.EscapeType.NewLine);
            var item2  = Creator.Content(PeterPiper.Hl7.V2.Support.Standard.EscapeType.Indent);

            target.Set(index, item1);
            Assert.AreEqual("HelloWorld~Bye&SecondComponent", target.AsString, "A test for Set");
            Assert.AreEqual(".br", target.Content(1).AsStringRaw, "A test for Set");
            target.Set(10, item2);
            Assert.AreEqual("Hello\\.br\\World\\R\\Bye\\.in\\&SecondComponent", target.AsStringRaw, "A test for Set");
        }