Exemple #1
0
 public void InsertionDeletionTest()
 {
     BusinessLogic bl = new BusinessLogicImpl();
       Button button = new Button(-1, "Testbutton", "no assignment");
       Preset p = new Preset(-1, "TestPreset1", "green", new List<Button> { button });
       bool b = bl.InsertPresetEager(p);
       Assert.IsTrue(b == true);
       b = bl.DeletePresetEager(p);
       Assert.IsTrue(b == true);
 }
Exemple #2
0
 public void InsertionTestNotValid1()
 {
     BusinessLogic bl = new BusinessLogicImpl();
       Button button = new Button(-1, "Testbutton", "no assignment");
       Preset p = new Preset(-1,
     "TestPreset1dddddccccccccccccccccccccccccccvewvewvewvwccccccscaaaaaaasfhtrjzstnymsg,ts,tzs," +
     "sztdfbdbddsdvdsd sd sd sdveqwqqvwebwbwsfefewvwevwvewveevffffffffffffffffffffffffffffffffffff",
     "green", new List<Button> { button });
       bool b = bl.InsertPresetEager(p);
       Assert.IsTrue(b == false);
       b = bl.DeletePresetEager(p);
       Assert.IsTrue(b == false);
 }
 public void PresetDAOButtonDeletion()
 {
     IDatabase database = DALFactory.CreateDatabase();
       IPresetDAO presetDAO = DALFactory.CreatePresetDAO(database);
       presetDAO.DeleteAllEager();
       Button button = new Button(-1, "Testbutton", "no assignment");
       Preset p = new Preset(-1, "TestPreset1", "green", new List<Button> { button });
       int i = presetDAO.InsertEager(p);
       int k = presetDAO.DeleteButtonEager(button);
       Assert.IsTrue(i == 2);
       Assert.IsTrue(k == 1);
       presetDAO.DeleteAllEager();
 }
 static void Main(string[] args)
 {
     BusinessLogicImpl bl = new BusinessLogicImpl();
       Button button1 = new Button(-1, "Button 1", "message 1");
       Button button2 = new Button(-1, "Button 2", "message 2");
       Button button3 = new Button(-1, "Button 3", "message 3");
       Button button4 = new Button(-1, "Button 4", "message 4");
       Button button5 = new Button(-1, "Button 5", "message 5");
       Button button6 = new Button(-1, "Button 6", "message 6");
       Preset preset = new Preset(-1, "Test-Preset", "green", new List<Button> (
     new Button[] { button1, button2, button3, button4, button5, button6}));
       bl.InsertPresetEager(preset);
 }
 public void PresetDAOFindByName()
 {
     IDatabase database = DALFactory.CreateDatabase();
       IPresetDAO presetDAO = DALFactory.CreatePresetDAO(database);
       presetDAO.DeleteAllEager();
       Button button = new Button(-1, "Testbutton", "no assignment");
       Button button2 = new Button(-1, "Testbutton2", "no assignment2");
       Preset p = new Preset(-1, "TestPreset1", "green", new List<Button> { button });
       Preset p2 = new Preset(-1, "TestPreset2", "yellow", new List<Button> { button2 });
       presetDAO.InsertEager(p);
       presetDAO.InsertEager(p2);
       Preset preset = presetDAO.FindByName("TestPreset1");
       Assert.IsTrue(preset.Equals(p));
       presetDAO.DeleteAllEager();
 }
 public void PresetDAOFindAll()
 {
     IDatabase database = DALFactory.CreateDatabase();
       IPresetDAO presetDAO = DALFactory.CreatePresetDAO(database);
       presetDAO.DeleteAllEager();
       Button button = new Button(-1, "Testbutton", "no assignment");
       Button button2 = new Button(-1, "Testbutton2", "no assignment2");
       Preset p = new Preset(-1, "TestPreset1", "green", new List<Button> { button });
       Preset p2 = new Preset(-1, "TestPreset2", "yellow", new List<Button> { button2 });
       presetDAO.InsertEager(p);
       presetDAO.InsertEager(p2);
       IList<Preset> presets = presetDAO.FindAll();
       Assert.IsTrue(presets.Count == 2);
       Assert.IsTrue(presets[0].buttons.Count == 1);
       Assert.IsTrue(presets[1].buttons.Count == 1);
       presetDAO.DeleteAllEager();
 }
Exemple #7
0
 public void UpdateTest3()
 {
     BusinessLogic bl = new BusinessLogicImpl();
       Button button = new Button(-1, "Testbutton", "no assignment");
       Preset p = new Preset(-1, "TestPreset1", "green", new List<Button> { button });
       bool b = bl.InsertPresetEager(p);
       Assert.IsTrue(b == true);
       p.buttons[0].name = "TestButton12";
       b = bl.UpdatePresetEager(p);
       Assert.IsTrue(b == true);
       b = bl.DeletePresetEager(p);
       Assert.IsTrue(b == true);
 }
 public bool AddButton(Button button)
 {
     if (this.buttons.Count < MAX_BUTTONS && !this.buttons.Contains(button)) {
     this.buttons.Add(button);
     return this.buttons.Count <= MAX_BUTTONS;
       } else return false;
 }
 private Preset CreatePreset()
 {
     Button b1 = null;
       Button b2 = null;
       Button b3 = null;
       Button b4 = null;
       Button b5 = null;
       Button b6 = null;
       if (selectedEmulation1 == "Shortcut" && presetName != null && presetName != "")
     b1 = new Button(-1, button1Text, "shortcut:" + selectedShortcut1 + "+" + textBox1);
       else
     b1 = new Button(-1, button1Text, textBox1);
       if (selectedEmulation2 == "Shortcut" && presetName != null && presetName != "")
     b1 = new Button(-1, button2Text, "shortcut:" + selectedShortcut2 + "+" + textBox2);
       else
     b1 = new Button(-1, button2Text, textBox2);
       if (selectedEmulation3 == "Shortcut" && presetName != null && presetName != "")
     b1 = new Button(-1, button3Text, "shortcut:" + selectedShortcut3 + "+" + textBox3);
       else
     b1 = new Button(-1, button3Text, textBox3);
       if (selectedEmulation4 == "Shortcut" && presetName != null && presetName != "")
     b1 = new Button(-1, button4Text, "shortcut:" + selectedShortcut4 + "+" + textBox4);
       else
     b1 = new Button(-1, button4Text, textBox4);
       if (selectedEmulation5 == "Shortcut" && presetName != null && presetName != "")
     b1 = new Button(-1, button5Text, "shortcut:" + selectedShortcut5 + "+" + textBox5);
       else
     b1 = new Button(-1, button5Text, textBox5);
       if (selectedEmulation6 == "Shortcut" && presetName != null && presetName != "")
     b1 = new Button(-1, button6Text, "shortcut:" + selectedShortcut6 + "+" + textBox6);
       else
     b1 = new Button(-1, button6Text, textBox6);
       IList<Button> buttons = new List<Button>(new Button[] { b1, b2, b3, b4, b5, b6 });
       Preset preset = new Preset(-1, presetName, selectedColor, buttons);
       return preset;
 }