// // 编写测试时,可以使用以下附加特性: // // 在运行类中的第一个测试之前使用 ClassInitialize 运行代码 // [ClassInitialize()] // public static void MyClassInitialize(TestContext testContext) { } // // 在类中的所有测试都已运行之后使用 ClassCleanup 运行代码 // [ClassCleanup()] // public static void MyClassCleanup() { } // // 在运行每个测试之前,使用 TestInitialize 来运行代码 // [TestInitialize()] // public void MyTestInitialize() { } // // 在每个测试运行完之后,使用 TestCleanup 来运行代码 // [TestCleanup()] // public void MyTestCleanup() { } // #endregion public void TestMethod1() { var parent = new Parent() { Name = "Parent" }; var getPropertyResult = ReflectorHelper.GetProperty(parent, "name"); Assert.AreEqual("Parent", getPropertyResult); ReflectorHelper.SetProperty(parent, "name", "name1"); var getPropertyResult1 = ReflectorHelper.GetProperty(parent, "name"); Assert.AreEqual("name1", getPropertyResult1); ReflectorHelper.SetProperty(parent, "child.name", "childname"); var getPropertyResultChildName = ReflectorHelper.GetProperty(parent, "child.name"); Assert.AreEqual("childname", getPropertyResultChildName); }
public IQuery <T> LikeNullable(Expression <Func <T, Object> > propertyExpression, String val) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(LikeNullable(info.Name, val)); }
public IQuery <T> InNullable(Expression <Func <T, Object> > propertyExpression, IList paramValues) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(InNullable(info.Name, paramValues)); }
public IQuery <T> BetweenNullable(Expression <Func <T, Object> > propertyExpression, Object val, Object val2) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(BetweenNullable(info.Name, val, val2)); }
public IQuery <T> NotEqual(Expression <Func <T, Object> > propertyExpression, Object val) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(NotEqual(info.Name, val)); }
public IQuery <T> GreaterThanEquals(Expression <Func <T, Object> > propertyExpression, Object val) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(GreaterThanEquals(info.Name, val)); }
public IQuery <T> Paging(Int32 pageNumber, Int32 pageSize, Expression <Func <T, Object> > propertyExpression, Boolean isAscending) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(Paging(pageNumber, pageSize, info.Name, isAscending)); }
public IQuery <T> Order(Expression <Func <T, Object> > propertyExpression, Boolean asc) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(Order(info.Name, asc)); }
public IQuery <T> Constrain(Expression <Func <T, Object> > propertyExpression) { PropertyInfo info = ReflectorHelper.GetProperty(propertyExpression); return(Constrain(info.Name)); }