예제 #1
0
 public void OneSeqEmpty()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] {
         new ExpectedServiceAttribute(65535, ElementType.ElementSequence, ElementTypeDescriptor.ElementSequence, new ExpectedServiceElement[0])
     };
     DoTest(expected, Data_SimpleRecords.OneSeqEmpty);
 }
예제 #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");
        }
예제 #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);
 }
예제 #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);
 }
예제 #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");
        }
예제 #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);
        }
예제 #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
 }
예제 #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);
        }
예제 #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);
        }
예제 #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);
 }
예제 #11
0
 public void Int8()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(0, ElementType.Int8, ElementTypeDescriptor.TwosComplementInteger, 0) };
     DoTest(expected, Data_SimpleRecords.OneInt8ZeroZero);
 }
예제 #12
0
 public void OneBooleanNonZero()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(Data_SimpleRecords.IdF123Uint, ElementType.Boolean, ElementTypeDescriptor.Boolean, true) };
     DoTest(expected, Data_SimpleRecords.OneBooleanNonZero);
 }
예제 #13
0
 public void Nil()
 {
     ExpectedServiceAttribute[] expected = new ExpectedServiceAttribute[] { new ExpectedServiceAttribute(0, ElementType.Nil, ElementTypeDescriptor.Nil, null) };
     DoTest(expected, Data_SimpleRecords.OneNil);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }