public SlicerResult VisitTestCondition(TestCondition tc, BackwardSlicerContext ctx) { var se = tc.Expression.Accept(this, BackwardSlicerContext.Cond(RangeOf(tc.Expression))); this.ccNext = tc.ConditionCode; return(se); }
protected void btnMen3_Click(object sender, EventArgs e) { string sProductGUID = "a3ba18d1-b7d0-488c-9687-706873e0ee53"; productGUID = new Guid(sProductGUID); try { product = ProductController.GetProductDeepByGUID(productGUID); //make sure we have a product TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id"); //set the page variables productID = product.ProductID; productSku = product.Sku; product.Quantity = 3; OrderController.AddItem(product); AddKeyForOrderMotion(); //This behavior is by design //See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpresponseclassendtopic.asp Response.Redirect("additemresult.aspx", false); //Response.Redirect("order.aspx", false); KPL } catch (Exception ex) { LovRubLogger.LogException(ex); // 04/10/08 KPL added throw ex; } }
private Expression CreateTestCondition(ConditionCode cc, Opcode opcode) { var grf = orw.FlagGroup(X86Instruction.UseCc(opcode)); var tc = new TestCondition(cc, grf); return(tc); }
private Expression CreateTestCondition(ConditionCode cc, Mnemonic mnemonic) { var grf = orw.FlagGroup(X86Instruction.UseCc(mnemonic) ?? throw new ArgumentException("Mnemonic not setting conditions")); var tc = new TestCondition(cc, grf); return(tc); }
protected void Page_Load(object sender, EventArgs e) { //this page can be accessed using a CategoryID (cid) //or by categoryName using the UrlRewriter categoryID = Utility.GetIntParameter("cid"); categoryName = Utility.GetParameter("n"); categoryGUID = Utility.GetParameter("guid"); if (!Page.IsPostBack) { LoadData(); } //############################################################################### // Page Validators - these must be implemented or they will be redirected //############################################################################### try { TestCondition.IsTrue(ds.Tables.Count == 6, "Invalid Query"); TestCondition.IsTrue(ds.Tables[0].Rows.Count > 0, "Invalid Query"); } catch (Exception ex) { ExceptionPolicy.HandleException(ex, "Application Exception"); Response.Redirect(Page.ResolveUrl("~/ExceptionPage.aspx"), false); } //############################################################################## //track this LoadPage(); //TickStats(); KPL }
protected void btnWomen3_Click(object sender, EventArgs e) { string sProductGUID = "f6d3b994-d5ca-491f-b55a-f22fa8974b25"; productGUID = new Guid(sProductGUID); try { product = ProductController.GetProductDeepByGUID(productGUID); //make sure we have a product TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id"); //set the page variables productID = product.ProductID; productSku = product.Sku; product.Quantity = 3; OrderController.AddItem(product); AddKeyForOrderMotion(); //This behavior is by design //See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpresponseclassendtopic.asp Response.Redirect("additemresult.aspx", false); //Response.Redirect("order.aspx", false); KPL } catch (Exception ex) { LovRubLogger.LogException(ex); // 04/10/08 KPL added throw ex; //ExceptionPolicy.HandleException(ex, "Application Exception"); //Response.Redirect(Page.ResolveUrl("~/ExceptionPage.aspx"), false); } }
/**************************************************************** * * AddToCart() * ***************************************************************/ protected void AddToCart(string sGUID, int nQty) { productGUID = new Guid(sGUID); try { product = ProductController.GetProductDeepByGUID(productGUID); //make sure we have a product TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id"); //set the page variables productID = product.ProductID; productSku = product.Sku; product.Quantity = nQty; OrderController.AddCallCenterItem(product); /******************** * //* the following if stmt is to track orders from TheLoveDepot.com 2/10 * string sID = ""; * sID = HttpContext.Current.Request.Cookies["ID"].Value; * if (sID != null) * { * Order currentOrder = OrderController.GetCurrentOrder(); * OrderController.AddNote(sID, currentOrder); * } **************/ } catch (Exception ex) { LovRubLogger.LogException(ex); throw ex; } }
private Expression CreateTestCondition(ConditionCode cc, Mnemonic mnemonic) { var grf = orw.FlagGroup(X86Instruction.UseCc(mnemonic)); var tc = new TestCondition(cc, grf); return(tc); }
public void EvcTestCondition() { TestCondition tc1 = new TestCondition(ConditionCode.EQ, new Identifier("a", PrimitiveType.Word32, new TemporaryStorage("a", 1, PrimitiveType.Word32))); TestCondition tc2 = new TestCondition(ConditionCode.EQ, new Identifier("a", PrimitiveType.Word32, new TemporaryStorage("a", 1, PrimitiveType.Word32))); Assert.IsTrue(eq.Equals(tc1, tc2)); Assert.AreEqual(eq.GetHashCode(tc1), eq.GetHashCode(tc2)); }
void IExpressionVisitor.VisitTestCondition(TestCondition tc) { Method("Test"); writer.Write($"ConditionCode.{tc}"); writer.Write(", "); tc.Expression.Accept(this); writer.Write(")"); }
public Result VisitTestCondition(TestCondition tc) { var t = new TestCondition( tc.ConditionCode, SimplifyExpression(tc.Expression).PropagatedExpression); return(SimplifyExpression(t)); }
public override Expression VisitTestCondition(TestCondition tc) { SsaIdentifier sid = ssaIds[(Identifier)tc.Expression]; sid.Uses.Remove(useStm !); Expression c = UseGrfConditionally(sid, tc.ConditionCode); Use(c, useStm !); return(c); }
public void VisitTestCondition(TestCondition tc) { w.Write('['); js.Write("test"); w.Write(','); js.Write(tc.ConditionCode.ToString()); w.Write(','); tc.Expression.Accept(this); w.Write(']'); }
protected void CondBranch(TestCondition test) { rtlc = RtlClass.ConditionalTransfer; if (instrCurr.op1 is PICOperandProgMemoryAddress brop) { m.Branch(test, PICProgAddress.Ptr(brop.CodeTarget.ToUInt32()), rtlc); return; } throw new InvalidOperationException($"Wrong PIC program relative address: op1={instrCurr.op1}."); }
public Expression VisitTestCondition(TestCondition tc) { var cond = tc.Expression.Accept(this); if (cond is InvalidConstant) { return(tc); } return(new TestCondition(tc.ConditionCode, cond)); }
void Page_Load(object sender, EventArgs e) { //############################################################################### // Page Validators //############################################################################### //your transaction ID can be null/empty if your account is not validated, verified, if //your business email is wrong, your PDT id is wrong, or PayPal's just having a bad day TestCondition.IsNotNull(Request.QueryString["tx"], "No TransactionID - Invalid"); TestCondition.IsNotNull(Request.QueryString["cm"], "No TransactionID - Invalid"); //############################################################################## string ppTX = Request.QueryString["tx"].ToString(); string sOrderID = Request.QueryString["cm"].ToString(); string pdtResponse = GetPDT(ppTX); //all we need at this point is the SUCCESS flag if (pdtResponse.StartsWith("SUCCESS")) { string sAmount = GetPDTValue(pdtResponse, "mc_gross"); //make sure the totals add up try { //make sure to unencode it sOrderID = Server.UrlDecode(sOrderID); Order order = OrderController.GetOrder(sOrderID); if (order != null) { //commit the order OrderController.CommitStandardOrder(order, ppTX, decimal.Parse(sAmount)); //send off to the receipt page Response.Redirect("../receipt.aspx?t=" + sOrderID, true); } else { Response.Write("Can't find the order"); } } catch (Exception x) { Response.Write("Invalid Order: " + x.Message); } } else { Response.Write("PDT Failure: " + pdtResponse); } }
public async Task <TestCase> Duplicate(long testCaseId) { var testCase = await _context.TestCases .AsNoTracking() .Include(c => c.TestActions) .Include(c => c.TestConditions) .Include(c => c.ExpectedResults) .FirstOrDefaultAsync(c => c.Id == testCaseId); var cloneTestCase = new TestCase() { Description = $"{testCase.Description} (copy)", Priority = testCase.Priority, TestModuleId = testCase.TestModuleId, IsEnabled = testCase.IsEnabled, IsAutomated = testCase.IsAutomated, LastTested = null, TestActions = new List <TestAction>(), TestConditions = new List <TestCondition>(), ExpectedResults = new List <ExpectedResult>() }; foreach (var testAction in testCase.TestActions) { var cloneTestAction = new TestAction() { Description = testAction.Description, Sequence = testAction.Sequence }; cloneTestCase.TestActions.Add(cloneTestAction); } foreach (var testCondition in testCase.TestConditions) { var cloneTestCondition = new TestCondition() { Description = testCondition.Description }; cloneTestCase.TestConditions.Add(cloneTestCondition); } foreach (var expectedResult in testCase.ExpectedResults) { var cloneExpectedResult = new ExpectedResult() { Description = expectedResult.Description }; cloneTestCase.ExpectedResults.Add(cloneExpectedResult); } return(cloneTestCase); }
public async Task <List <TestCondition> > Sort(TestCondition fromCondition, long targetId) { var testConditions = await _context.TestConditions.Where(a => a.TestCaseId == fromCondition.TestCaseId).OrderBy(a => a.Sequence).ToListAsync(); var origin = testConditions.SingleOrDefault(t => t.Id == fromCondition.Id); var target = testConditions.SingleOrDefault(t => t.Id == targetId); var result = await SortBySequence(testConditions, origin, target); return(result.ConvertAll(x => (TestCondition)x)); }
/// <summary> /// Skips a test based on the passed condition. /// </summary> public GenericFactAttribute(TestCondition feature, bool error) : base(AFTests.KeySetting, AFTests.KeySettingTypeCode) { // Return if the Skip property has been changed in the base constructor if (!string.IsNullOrEmpty(Skip)) { return; } GenericAttribute.InitializeSkip(feature, error, out string skip); Skip = skip; }
public IEnumerable <Test> Search([FromUri] TestCondition c) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif using (var db = new peppaDB()) { var q = db.Test; var list = (c == null ? q : q.Where(c.CreatePredicate())).ToList(); return(list); } }
void ValidatePage() { //Page Validation //1) Need items in order to checkout try { TestCondition.IsTrue(currentOrder.Items.Count > 0, "There are not items in your cart"); } catch { //send them to the basket page Response.Redirect("~/Basket.aspx", false); } //2) Need to have this page under SSL! Utility.TestForSSL(); }
public IActionResult Remove([FromQuery] TestCondition c) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif using (var db = new peppaDB()) { var count = db.Test .Where(c.CreatePredicate()) .Delete(); return(Ok(count)); } }
public IActionResult Count([FromQuery] TestCondition c) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif using (var db = new peppaDB()) { var count = c == null?db.Test.Count() : db.Test.Count(predicate: c.CreatePredicate()); return(Ok(count)); } }
public IActionResult Search([FromQuery] TestCondition c, [FromQuery] string[] order, int currentPage = 1, int pageSize = 10, DateTime?p_when = null) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif using (var db = new peppaDB()) { var q = db.Test ; var filtered = c == null ? q : q.Where(c.CreatePredicate()); var ordered = order.Any() ? filtered.SortBy(order) : filtered; var result = ordered.Skip((currentPage - 1) * pageSize).Take(pageSize).ToList(); return(Ok(result)); } }
/**************************************************************** * * AddToCart() * * *************************************************************/ void AddToCart(string sGUID, int nQty) { //string sFemaleProductGUID = "f6d3b994-d5ca-491f-b55a-f22fa8974b25"; productGUID = new Guid(sGUID); try { product = ProductController.GetProductDeepByGUID(productGUID); //make sure we have a product TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id"); //set the page variables productID = product.ProductID; productSku = product.Sku; product.Quantity = nQty; OrderController.AddCallCenterItem(product); //********************************************************************************** // Add keycode for OrderMotion // but only add one note, so check to see if the keycode note has already been added. //********************************************************************************** bool bIsCallCtrOrder = false; currentOrder = OrderController.GetCurrentOrder(); OrderNoteCollection noteCollection = currentOrder.Notes; int nCount = noteCollection.Count; for (int nIndex = 0; nCount > nIndex; nIndex++) { OrderNote note = noteCollection[nIndex]; //if (note.Equals("CALLCENTER")) if (true == note.Note.Equals("CALLCENTER")) { bIsCallCtrOrder = true; break; } } if (false == bIsCallCtrOrder) { OrderController.AddNote("CALLCENTER", currentOrder); } } catch (Exception ex) { LovRubLogger.LogException(ex); throw ex; } }
protected void Page_Load(object sender, EventArgs e) { //############################################################################### // Page Validators - these must be implemented or they will be redirected //############################################################################### try { string sProductGUID = Utility.GetParameter("guid"); productID = Utility.GetIntParameter("id"); productSku = Utility.GetParameter("n"); if (sProductGUID != string.Empty) { productGUID = new Guid(sProductGUID); product = ProductController.GetProductDeepByGUID(productGUID); } else if (productID != 0) { product = ProductController.GetProductDeep(productID); } else if (productSku != string.Empty) { product = ProductController.GetProductDeep(productSku); } //make sure we have a product TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id"); //set the page variables productID = product.ProductID; productSku = product.Sku; } catch (Exception ex) { //throw ex; //ExceptionPolicy.HandleException(ex, "Application Exception"); Response.Redirect(Page.ResolveUrl("~/ExceptionPage.aspx"), false); } //############################################################################## //load the product ratings BindProductInfo(); //TickStats(); KPL }
internal static void EvaluateConditions(DbConnection validationConnection, SqlExecutionResult[] results, Collection <TestCondition> conditions) { int count = conditions.Count; for (int i = 0; i < count; i++) { TestCondition condition = conditions[i]; if (condition == null) { object[] args = { i }; throw new AssertFailedException(string.Format(CultureInfo.CurrentCulture, "Condition at index {0} was null. Conditions cannot be null.", args)); } if (condition.Enabled) { PrintMessage("Validating {0}", condition.Name); condition.Assert(validationConnection, results); } } }
/// <summary> /// Creates Game1. /// </summary> public GMGame CreateGame1() { //create games and add triggers GMGame game = new GMGame("game1"); //create conditions ACondition cond1 = new TestCondition("Test-Cond-1", true); //ACondition cond2 = new TestCondition("Test-Cond-2", true); ACondition falseCond = new FalseCondition(); ACondition trueCond = new TrueCondition(); ACondition relTimeCond = new TimerCondition(TimerType.Relative, 1, game.TimeSource); //true after 1sec //create triggers ScriptTrigger<int> trigger1 = new ScriptTrigger<int>( 2, 500, trueCond.Check, null, TestScriptFunctionInt, 111); ScriptTrigger<int> trigger2 = new ScriptTrigger<int>(); trigger2.Value = 222; trigger2.Function = TestScriptFunctionInt; trigger2.Priority = 3; trigger2.Repeat = 3; trigger2.FireCondition = cond1.Check; //this will only be fired, when both fireCondition is true at the same time ScriptTrigger<string> trigger3 = new ScriptTrigger<string>(); trigger3.Value = "game2"; trigger3.Function = TestScriptFunctionString; trigger3.Priority = 1; trigger3.Repeat = 1; //only fire once trigger3.FireCondition += trueCond.Check; //always true, but you can check sg extra here trigger3.FireCondition += relTimeCond.Check; //should fire only when time reached trigger3.DeleteCondition = falseCond.Check; //don't remove until repeating game.AddTrigger(trigger1); game.AddTrigger(trigger2); Debug.Log ("Added trigger 3"); game.AddTrigger(trigger3); return game; }
/**************************************************************** * * AddToCart() * * *************************************************************/ void AddToCart(string sGUID, int nQty) { productGUID = new Guid(sGUID); try { product = ProductController.GetProductDeepByGUID(productGUID); //make sure we have a product TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id"); //set the page variables productID = product.ProductID; productSku = product.Sku; product.Quantity = nQty; OrderController.AddCallCenterItem(product); } catch (Exception ex) { LovRubLogger.LogException(ex); throw ex; } }
public static Commerce.Common.Transaction RunCharge(Commerce.Common.Order order) { //validations //CCNumber TestCondition.IsTrue(IsValidCardType(order.CreditCardNumber, order.CreditCardType), "Invalid Credit Card Number"); //current expiration DateTime expDate = new DateTime(order.CreditCardExpireYear, order.CreditCardExpireMonth, 28); TestCondition.IsTrue(expDate >= DateTime.Today, "This credit card appears to be expired"); //amount>0 TestCondition.IsGreaterThanZero(order.OrderTotal, "Charge amount cannot be 0 or less"); Commerce.Common.Transaction result = Instance.Charge(order); result.TransactionDate = DateTime.UtcNow; result.Amount = order.OrderTotal; return(result); }
/// <summary> the method is responsible for compiling a TestCE pattern to a testjoin node. /// It uses the globally declared prevCE and prevJoinNode /// </summary> public virtual BaseJoin compileJoin(ICondition condition, int position, Rule.IRule rule) { TestCondition tc = (TestCondition)condition; ShellFunction fn = (ShellFunction)tc.Function; fn.lookUpFunction(ruleCompiler.Engine); IParameter[] oldpm = fn.Parameters; IParameter[] pms = new IParameter[oldpm.Length]; for (int ipm = 0; ipm < pms.Length; ipm++) { if (oldpm[ipm] is ValueParam) { pms[ipm] = ((ValueParam)oldpm[ipm]).cloneParameter(); } else if (oldpm[ipm] is BoundParam) { BoundParam bpm = (BoundParam)oldpm[ipm]; // now we need to resolve and setup the BoundParam Binding b = rule.getBinding(bpm.VariableName); BoundParam newpm = new BoundParam(b.LeftRow, b.LeftIndex, 9, bpm.ObjectBinding); newpm.VariableName = bpm.VariableName; pms[ipm] = newpm; } } BaseJoin joinNode = null; if (tc.Negated) { joinNode = new NTestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms); } else { joinNode = new TestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms); } ((TestNode)joinNode).lookUpFunction(ruleCompiler.Engine); return(joinNode); }
public virtual void VisitTestCondition(TestCondition tc) { tc.Expression.Accept(this); }
public void VisitTestCondition(TestCondition test) { throw new NotImplementedException(); }
public void ExecuteTransitions() { // should execute transitions TestCondition condition1 = new TestCondition(); TestCondition condition2 = new TestCondition(); origin.AddTransition(target , new Condition[]{ condition1 }, true); origin.AddTransition(target , new Condition[]{ condition2 }, true); UUnitAssert.False( condition1.executed ); UUnitAssert.False( condition2.executed ); origin.Execute(context); UUnitAssert.True( condition1.executed ); UUnitAssert.True( condition2.executed ); }
public override Expression VisitTestCondition(TestCondition tc) { SsaIdentifier sid = ssaIds[(Identifier) tc.Expression]; sid.Uses.Remove(useStm); Expression c = UseGrfConditionally(sid, tc.ConditionCode); Use(c, useStm); return c; }
private Expression CreateTestCondition(ConditionCode cc, Opcode opcode) { var grf = orw.FlagGroup(IntelInstruction.UseCc(opcode)); var tc = new TestCondition(cc, grf); return tc; }
public void VisitTestCondition(TestCondition tc) { writer.Write("Test({0},", tc.ConditionCode); WriteExpression(tc.Expression); writer.Write(")"); }
public override void VisitTestCondition(TestCondition tc) { tc.Expression.Accept(this); EnsureTypeVariable(tc); }