public void Can_get_fields_list_from_Typed_object() { Assert.That(ExpressionUtils.GetFieldNames((Poco x) => new Poco { Id = x.Id, Name = x.Name }), Is.EquivalentTo(new[] { "Id", "Name" })); }
public void Can_get_fields_from_abstract_base_class() { Assert.That(ExpressionUtils.GetFieldNames <Derived>(p => p.BaseMember), Is.EquivalentTo(new[] { "BaseMember" })); Assert.That(ExpressionUtils.GetFieldNames <Derived>(p => p.DerivedMember), Is.EquivalentTo(new[] { "DerivedMember" })); }
public void Can_get_fields_list_from_property_expression() { Assert.That(ExpressionUtils.GetFieldNames((Poco x) => x.Name), Is.EquivalentTo(new[] { "Name" })); Assert.That(ExpressionUtils.GetFieldNames((Poco x) => x.Id), Is.EquivalentTo(new[] { "Id" })); }
public void Can_get_fields_list_from_list() { var list = new List <string> { "Id", "Name" }; Assert.That(ExpressionUtils.GetFieldNames((Poco x) => list), Is.EquivalentTo(new[] { "Id", "Name" })); }
public void Can_get_fields_list_from_array() { Assert.That(ExpressionUtils.GetFieldNames((Poco x) => new[] { "Id", "Name" }), Is.EquivalentTo(new[] { "Id", "Name" })); var id = "Id"; Assert.That(ExpressionUtils.GetFieldNames((Poco x) => new[] { id, "Na" + "me" }), Is.EquivalentTo(new[] { "Id", "Name" })); }