protected void SubmitNewTone(object sender, EventArgs e) { //insert trigger ScreenShotActions data = new ScreenShotActions(); ToneTrigger toneTrigger = new ToneTrigger() { userName = UserDropDownList.Text, sensitivity = int.Parse(colorSensitivity.Text), lowerColorBound = ColorTranslator.FromHtml('#' + colorLBTB.Text), upperColorBound = ColorTranslator.FromHtml('#' + colorUBTB.Text) }; data.insertToneTrigger(toneTrigger); //refresh the triggers to bring back down the new trigger RefreshTriggers(data); //clear text boxes for a new trigger to be entered Clear(colorSensitivity); Clear(colorLBTB); Clear(colorUBTB); }
public void toneTriggerFullTest() { //insert ScreenShotActions target = new ScreenShotActions(true); ToneTrigger toneTrigger = new ToneTrigger(); toneTrigger.userName = "******"; toneTrigger.userEmail = "TEST@"; toneTrigger.lowerColorBound = Color.AliceBlue; toneTrigger.upperColorBound = Color.Azure; toneTrigger.sensitivity = 80; Guid id = target.insertToneTrigger(toneTrigger); Assert.IsNotNull(id); //update int newVal = 70; var allTriggers = target.getAllToneTriggers(); ToneTrigger outTrigger = allTriggers.First(t => t.id.Equals(id)); outTrigger.sensitivity = newVal; target.updateToneTrigger(outTrigger); allTriggers = target.getAllToneTriggers(); outTrigger = allTriggers.First(t => t.id.Equals(id)); Assert.AreEqual(newVal, outTrigger.sensitivity); //delete target.deleteToneTrigger(outTrigger.id); Assert.AreEqual(target.getAllToneTriggers().Count(t => t.id.Equals(id)), 0); }
public void insertToneTriggerTest() { ScreenShotActions target = new ScreenShotActions(true); ToneTrigger toneTrigger = new ToneTrigger(); toneTrigger.userName = "******"; toneTrigger.userEmail = "TEST@"; toneTrigger.lowerColorBound = Color.AliceBlue; toneTrigger.upperColorBound = Color.Azure; toneTrigger.sensitivity = 80; Guid actual = target.insertToneTrigger(toneTrigger); Assert.IsNotNull(actual); }