public void Identifies_binary_operation_as_invalid_expression() { var dao = new DataAccessOnlyAnalyser(); var enp = new ExpressionNodePath(); Expression <Func <DateTime, long> > testLambda = ((DateTime a) => a.Ticks + 9); dao.Initialise(testLambda.Parameters[0]); enp.Add(new ClassifiedExpression(testLambda.Body)); Assert.IsFalse(dao.ShouldProviderHandleExpression(enp)); }
public void Identifies_data_based_array_index_as_valid_expression() { var dao = new DataAccessOnlyAnalyser(); var enp = new ExpressionNodePath(); Expression <Func <string[], string> > testLambda = ((string[] a) => a[a.GetHashCode()]); dao.Initialise(testLambda.Parameters[0]); enp.Add(new ClassifiedExpression(testLambda.Body)); Assert.IsTrue(dao.ShouldProviderHandleExpression(enp)); }
public void Identifies_field_access_as_valid_expression() { var dao = new DataAccessOnlyAnalyser(); var enp = new ExpressionNodePath(); Expression <Func <ClassWithField, long> > testLambda = ((ClassWithField a) => a.Test); dao.Initialise(testLambda.Parameters[0]); enp.Add(new ClassifiedExpression(testLambda.Body)); Assert.IsTrue(dao.ShouldProviderHandleExpression(enp)); }
public void Identifies_constant_as_invalid_expression() { var dao = new DataAccessOnlyAnalyser(); var enp = new ExpressionNodePath(); Expression <Func <string, int> > testLambda = ((string a) => 1); dao.Initialise(testLambda.Parameters[0]); enp.Add(new ClassifiedExpression(testLambda.Body)); Assert.IsFalse(dao.ShouldProviderHandleExpression(enp)); }
public void Identifies_extension_method_call_as_invalid_expression() { var dao = new DataAccessOnlyAnalyser(); var enp = new ExpressionNodePath(); Expression <Func <string, IEnumerable <char> > > testLambda = ((string a) => a.Reverse()); dao.Initialise(testLambda.Parameters[0]); enp.Add(new ClassifiedExpression(testLambda.Body)); Assert.IsFalse(dao.ShouldProviderHandleExpression(enp)); }
public void Identifies_member_access_and_indexer_as_valid_expression() { var dao = new DataAccessOnlyAnalyser(); var enp = new ExpressionNodePath(); Expression <Func <string, char> > testLambda = ((string a) => a.ToString()[0]); dao.Initialise(testLambda.Parameters[0]); enp.Add(new ClassifiedExpression(testLambda.Body)); Assert.IsTrue(dao.ShouldProviderHandleExpression(enp)); }
public void Identifies_non_data_based_array_as_invalid_expression() { var dao = new DataAccessOnlyAnalyser(); var enp = new ExpressionNodePath(); Expression <Func <string, char> > testLambda = ((string a) => DateTime.Now.ToString()[a.GetHashCode()]); dao.Initialise(testLambda.Parameters[0]); enp.Add(new ClassifiedExpression(testLambda.Body)); Assert.IsFalse(dao.ShouldProviderHandleExpression(enp)); }