public static void ToSql(NotContains expression, StringBuilder builder) { if (null == expression) { throw new ArgumentNullException("expression"); } if (null == builder) { throw new ArgumentNullException("builder"); } if (expression.Operands.Count > 0) { IToken operand1 = expression.Operands .First(); IToken operand2 = expression.Operands .ElementAtOrDefault(1); if (null != operand1 && null != operand2) { operand1.ToSql(builder); builder.Append(" NOT LIKE '%' +"); operand2.ToSql(builder); builder.Append("+ '%'"); } } }
public void NotContains_HandlesType_ReturnsNotContainsType() { var decisionType = enDecisionType.NotContain; //------------Setup for test-------------------------- var notContains = new NotContains(); //------------Execute Test--------------------------- //------------Assert Results------------------------- Assert.AreEqual(decisionType, notContains.HandlesType()); }
public StringFilter ToUpper() { Equal = Equal?.ToUpper(); NotEqual = NotEqual?.ToUpper(); Contains = Contains?.ToUpper(); NotContains = NotContains?.ToUpper(); StartsWith = StartsWith?.ToUpper(); NotStartsWith = NotStartsWith?.ToUpper(); EndsWith = EndsWith?.ToUpper(); NotEndsWith = NotEndsWith?.ToUpper(); return(this); }
public void NotContains_Invoke_DoesntContain_ReturnsTrue() { //------------Setup for test-------------------------- var notStartsWith = new NotContains(); string[] cols = new string[2]; cols[0] = "TestData"; cols[1] = "No"; //------------Execute Test--------------------------- bool result = notStartsWith.Invoke(cols); //------------Assert Results------------------------- Assert.IsTrue(result); }
public StringFilter ToUpper() { if (Equal != null) { Equal = Equal.ToUpper(); } if (NotEqual != null) { NotEqual = NotEqual.ToUpper(); } if (Contains != null) { Contains = Contains.ToUpper(); } if (NotContains != null) { NotContains = NotContains.ToUpper(); } if (StartsWith != null) { StartsWith = StartsWith.ToUpper(); } if (NotStartsWith != null) { NotStartsWith = NotStartsWith.ToUpper(); } if (EndsWith != null) { EndsWith = EndsWith.ToUpper(); } if (NotEndsWith != null) { NotEndsWith = NotEndsWith.ToUpper(); } return(this); }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (InputObject.Expression != null) { targetCommand.AddParameter("InputObject", InputObject.Get(context)); } if (FilterScript.Expression != null) { targetCommand.AddParameter("FilterScript", FilterScript.Get(context)); } if (Property.Expression != null) { targetCommand.AddParameter("Property", Property.Get(context)); } if (Value.Expression != null) { targetCommand.AddParameter("Value", Value.Get(context)); } if (EQ.Expression != null) { targetCommand.AddParameter("EQ", EQ.Get(context)); } if (CEQ.Expression != null) { targetCommand.AddParameter("CEQ", CEQ.Get(context)); } if (NE.Expression != null) { targetCommand.AddParameter("NE", NE.Get(context)); } if (CNE.Expression != null) { targetCommand.AddParameter("CNE", CNE.Get(context)); } if (GT.Expression != null) { targetCommand.AddParameter("GT", GT.Get(context)); } if (CGT.Expression != null) { targetCommand.AddParameter("CGT", CGT.Get(context)); } if (LT.Expression != null) { targetCommand.AddParameter("LT", LT.Get(context)); } if (CLT.Expression != null) { targetCommand.AddParameter("CLT", CLT.Get(context)); } if (GE.Expression != null) { targetCommand.AddParameter("GE", GE.Get(context)); } if (CGE.Expression != null) { targetCommand.AddParameter("CGE", CGE.Get(context)); } if (LE.Expression != null) { targetCommand.AddParameter("LE", LE.Get(context)); } if (CLE.Expression != null) { targetCommand.AddParameter("CLE", CLE.Get(context)); } if (Like.Expression != null) { targetCommand.AddParameter("Like", Like.Get(context)); } if (CLike.Expression != null) { targetCommand.AddParameter("CLike", CLike.Get(context)); } if (NotLike.Expression != null) { targetCommand.AddParameter("NotLike", NotLike.Get(context)); } if (CNotLike.Expression != null) { targetCommand.AddParameter("CNotLike", CNotLike.Get(context)); } if (Match.Expression != null) { targetCommand.AddParameter("Match", Match.Get(context)); } if (CMatch.Expression != null) { targetCommand.AddParameter("CMatch", CMatch.Get(context)); } if (NotMatch.Expression != null) { targetCommand.AddParameter("NotMatch", NotMatch.Get(context)); } if (CNotMatch.Expression != null) { targetCommand.AddParameter("CNotMatch", CNotMatch.Get(context)); } if (Contains.Expression != null) { targetCommand.AddParameter("Contains", Contains.Get(context)); } if (CContains.Expression != null) { targetCommand.AddParameter("CContains", CContains.Get(context)); } if (NotContains.Expression != null) { targetCommand.AddParameter("NotContains", NotContains.Get(context)); } if (CNotContains.Expression != null) { targetCommand.AddParameter("CNotContains", CNotContains.Get(context)); } if (In.Expression != null) { targetCommand.AddParameter("In", In.Get(context)); } if (CIn.Expression != null) { targetCommand.AddParameter("CIn", CIn.Get(context)); } if (NotIn.Expression != null) { targetCommand.AddParameter("NotIn", NotIn.Get(context)); } if (CNotIn.Expression != null) { targetCommand.AddParameter("CNotIn", CNotIn.Get(context)); } if (Is.Expression != null) { targetCommand.AddParameter("Is", Is.Get(context)); } if (IsNot.Expression != null) { targetCommand.AddParameter("IsNot", IsNot.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public static void ToSql(NotContains expression, StringBuilder builder) { if (null == expression) throw new ArgumentNullException("expression"); if (null == builder) throw new ArgumentNullException("builder"); if (expression.Operands.Count > 0) { IToken operand1 = expression.Operands .First(); IToken operand2 = expression.Operands .ElementAtOrDefault(1); if (null != operand1 && null != operand2) { operand1.ToSql(builder); builder.Append(" NOT LIKE '%' +"); operand2.ToSql(builder); builder.Append("+ '%'"); } } }