コード例 #1
0
        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")));
        }
コード例 #2
0
        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++;
            }
        }