public void FieldExpressions_GetKey_Exceptions() { FieldExpressions expressions = new FieldExpressions(); Assert.ThrowsException <ArgumentNullException>(() => expressions.GetKey(null)); Assert.ThrowsException <KeyNotFoundException>(() => expressions.GetKey(new FieldExpression(source, "Table", "Field"))); }
public void FieldExpressions_GetEnumerator_Populated() { // Prepare test data string[] fields = new string[] { "FieldA", "FieldB" }; FieldExpressions expressions = new FieldExpressions(source, "Table", fields); // Check test result Assert.AreEqual(fields.Length, expressions.Count()); int next = 0; foreach (FieldExpression field in expressions) { Assert.AreEqual("Table", field.TableName); Assert.IsTrue(fields.Any(x => x == field.FieldName)); Assert.AreEqual($"f{next}", expressions.GetKey(field)); next++; } }