Example #1
0
 public void OneSeqEmpty()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] {
         new ExpectedServiceAttribute(65535, ElementType.ElementSequence, ElementTypeDescriptor.ElementSequence, new ExpectedServiceElement[0])
     };
     DoTest(expected, Data_SimpleRecords.OneSeqEmpty);
 }
Example #2
0
        public void Empty()
        {
            ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[0];
            ServiceRecord record = DoTest(expected, Data_SimpleRecords.Empty);

            Assert.AreEqual(Data_SimpleRecords.Empty, record.SourceBytes, "SourceBytes");
        }
Example #3
0
 public void OneStringBadUtf8()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] {
         new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.TextString, ElementTypeDescriptor.TextString,
                                      Data_SimpleRecords.OneStringBadUtf8_ValueBytes)
     };
     DoTest(expected, Data_SimpleRecords.OneStringBadUtf8);
 }
Example #4
0
 public void OneStringZeroLength()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] {
         new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.TextString, ElementTypeDescriptor.TextString,
                                      new byte[0])
     };
     DoTest(expected, Data_SimpleRecords.OneStringZeroLength);
 }
Example #5
0
        public void OneUrlLazyCreation()
        {
            ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.Url, ElementTypeDescriptor.Url,
                                                                                                                Data_SimpleRecords.OneUrlByteArrayValue) };
            ServiceRecord record = DoTestLazyUrlCreation(expected, Data_SimpleRecords.OneUrl);

            Assert.AreEqual(Data_SimpleRecords.OneUrl, record.SourceBytes, "SourceBytes");
        }
Example #6
0
        public void OneAltWithNil()
        {
            ExpectedServiceElement expectedValue = new ExpectedServiceElement(ElementType.Nil, ElementTypeDescriptor.Nil, null);

            ExpectedServiceElement[]   expectedFirstElementsChildren = new ExpectedServiceElement[] { expectedValue };
            ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] {
                new ExpectedServiceAttribute(65535, ElementType.ElementAlternative, ElementTypeDescriptor.ElementAlternative, expectedFirstElementsChildren)
            };
            DoTest(expected, Data_SimpleRecords.OneAltWithNil);
        }
Example #7
0
 private static void DoAreEqual(ExpectedServiceAttribute[] expectedAttributes, ServiceRecord record, int depth)
 {
     Assert.AreEqual(expectedAttributes.Length, record.Count, "Number of attributes.");
     for (int i = 0; i < expectedAttributes.Length; ++i)
     {
         ExpectedServiceAttribute expected   = expectedAttributes[i];
         ServiceAttribute         row        = record[i];
         ServiceAttributeId       expectedId = (ServiceAttributeId)expected.Id;
         Assert.AreEqual(expectedId, row.Id, "Attr Id.");
         DoAreEqual(expected, row.Value, depth + 1);
     }//for
 }
Example #8
0
        public void OneAltWithOneSeqWithNil()
        {
            ExpectedServiceElement expectedValue = new ExpectedServiceElement(ElementType.Nil, ElementTypeDescriptor.Nil, null);

            ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] {
                new ExpectedServiceAttribute(65535, ElementType.ElementAlternative, ElementTypeDescriptor.ElementAlternative, new ExpectedServiceElement[] {
                    new ExpectedServiceElement(ElementType.ElementSequence, ElementTypeDescriptor.ElementSequence, new ExpectedServiceElement[] {
                        new ExpectedServiceElement(ElementType.Nil, ElementTypeDescriptor.Nil, null)
                    })
                })
            };
            DoTest(expected, Data_SimpleRecords.OneAltWithOneSeqWithNil);
        }
Example #9
0
        public void OneAltWith__OneAltWithTwoNil_And_OneAltWithOneNil_And_Int8()
        {
            ExpectedServiceElement expectedValue = new ExpectedServiceElement(ElementType.Nil, ElementTypeDescriptor.Nil, null);

            ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] {
                new ExpectedServiceAttribute(65535, ElementType.ElementAlternative, ElementTypeDescriptor.ElementAlternative, new ExpectedServiceElement[] {
                    new ExpectedServiceElement(ElementType.ElementAlternative, ElementTypeDescriptor.ElementAlternative, new ExpectedServiceElement[] {
                        new ExpectedServiceElement(ElementType.Nil, ElementTypeDescriptor.Nil, null),
                        new ExpectedServiceElement(ElementType.Nil, ElementTypeDescriptor.Nil, null)
                    }),
                    new ExpectedServiceElement(ElementType.ElementAlternative, ElementTypeDescriptor.ElementAlternative, new ExpectedServiceElement[] {
                        new ExpectedServiceElement(ElementType.Nil, ElementTypeDescriptor.Nil, null),
                    })
                }),
                new ExpectedServiceAttribute(2, ElementType.UInt8, ElementTypeDescriptor.UnsignedInteger, 0x99)
            };
            DoTest(expected, Data_SimpleRecords.OneAltWith__OneAltWithTwoNil_And_OneAltWithOneNil__And_Int8);
        }
Example #10
0
 public void OneUrl()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.Url, ElementTypeDescriptor.Url,
                                                                                                         new Uri(Data_SimpleRecords.OneUrlStringValue)) };
     DoTest(expected, Data_SimpleRecords.OneUrl);
 }
Example #11
0
 public void Int8()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(0, ElementType.Int8, ElementTypeDescriptor.TwosComplementInteger, 0) };
     DoTest(expected, Data_SimpleRecords.OneInt8ZeroZero);
 }
Example #12
0
 public void OneBooleanNonZero()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.Boolean, ElementTypeDescriptor.Boolean, true) };
     DoTest(expected, Data_SimpleRecords.OneBooleanNonZero);
 }
Example #13
0
 public void Nil()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(0, ElementType.Nil, ElementTypeDescriptor.Nil, null) };
     DoTest(expected, Data_SimpleRecords.OneNil);
 }
Example #14
0
 public void OneUuid32()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.Uuid32, ElementTypeDescriptor.Uuid, Data_SimpleRecords.OneUuid32Value) };
     DoTest(expected, Data_SimpleRecords.OneUuid32);
 }
Example #15
0
 public void UInt128()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.UInt128, ElementTypeDescriptor.UnsignedInteger, Data_SimpleRecords.OneUInt128_Value) };
     DoTest(expected, Data_SimpleRecords.OneUInt128_F123_E987);
 }
Example #16
0
 public void Int64()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.Int64, ElementTypeDescriptor.TwosComplementInteger, Data_SimpleRecords.OneInt64_F123_E987654305060708_Value) };
     DoTest(expected, Data_SimpleRecords.OneInt64_F123_E987654305060708);
 }
Example #17
0
 public void Int8TopBitSet()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.Int8, ElementTypeDescriptor.TwosComplementInteger, Data_SimpleRecords.OneInt8F123_E9Value) };
     DoTest(expected, Data_SimpleRecords.OneInt8F123_E9);
 }