private static void DoAreEqual(ExpectedServiceElement[] expectedAttributes, ServiceElement[] values, int depth) { Assert.AreEqual(expectedAttributes.Length, values.Length, "Number of elements."); for (int i = 0; i < expectedAttributes.Length; ++i) { ExpectedServiceElement expected = expectedAttributes[i]; ServiceElement row = values[i]; DoAreEqual(expected, row, depth + 1); } //for }
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); }
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); }
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); }
private static void DoAreEqual(ExpectedServiceElement expected, ServiceElement value, int depth) { if (expected.Etd != value.ElementTypeDescriptor) { } Assert.AreEqual(expected.Etd, value.ElementTypeDescriptor, "ElementTypeDescriptor."); if (expected.ElementType != value.ElementType) { } Assert.AreEqual(expected.ElementType, value.ElementType, "ElementType."); if (expected.Etd == ElementTypeDescriptor.ElementSequence || expected.Etd == ElementTypeDescriptor.ElementAlternative) { ExpectedServiceElement[] expectedChildAttributes = expected.Children; ServiceElement[] children = value.GetValueAsElementArray(); DoAreEqual(expectedChildAttributes, children, depth + 1); } else { Assert.AreEqual(expected.Value, value.Value, "Element Value"); } }