public TestValueCollectionEnumerator(TestValueCollection collection) { this.collection = collection; this.Enumerator = collection.values.GetEnumerator(); }
public void ExecuteJoinTest( AttributeType sourceDataType, List <Transform> transforms, List <object> expectedValues, params List <object>[] sourceAttributes ) { TestCSEntry csentry = new TestCSEntry(); int count = 0; List <string> attributeNames = new List <string>(); foreach (List <object> attribute in sourceAttributes) { count++; string attributeName = "csattribute" + count; attributeNames.Add(attributeName); if (attribute.Count > 1) { csentry.Add(this.CreateAttribute(attributeName, sourceDataType, attribute)); } else if (attribute.Count == 1) { csentry.Add(this.CreateAttribute(attributeName, sourceDataType, false, attribute.First())); } else { throw new NullReferenceException("A value must be provided"); } } List <string> transformNames = new List <string>(); foreach (Transform transform in transforms) { transformNames.Add(transform.ID); } string flowRuleName = string.Format( "{0}>>{1}", attributeNames.ToSeparatedString("+"), transformNames.ToSeparatedString(">>")); ValueCollection collection = new TestValueCollection(sourceDataType); this.rulesExtension.MapAttributesForJoin(flowRuleName, csentry, ref collection); switch (sourceDataType) { case AttributeType.Binary: CollectionAssert.AreEqual(collection.ToByteArrays(), expectedValues, new ByteArrayComparer()); break; case AttributeType.Integer: CollectionAssert.AreEqual(collection.ToIntegerArray(), expectedValues); break; case AttributeType.String: CollectionAssert.AreEqual(collection.ToStringArray(), expectedValues); break; case AttributeType.Boolean: case AttributeType.Reference: case AttributeType.Undefined: default: throw new UnknownOrUnsupportedDataTypeException(); } }