public void TestSave() { try { // task1 = new Task("testCre", "task1", new DateTime(2019, 12, 12)); int id = InterfaceLayer.CreateNewTask("testCre", "task1", new DateTime(2019, 12, 12)); Saved_Task = Task.GetTaskByID(id); Assert.AreEqual(Saved_Task.getDescription(), "task1"); List <int> list = TaskDAL.GetTaskByColumn(1); if (!list.Contains(Saved_Task.getID())) { Assert.Fail("didn't save the task to the correct column"); } } catch (MileStone4.AlmogException ex) { Assert.Fail((String)ex.Value, new object[] { ex }); } catch (Exception e) { Assert.Fail(e.Message, new object[] { e }); } }
private void Create_Click(object sender, RoutedEventArgs e) { try { // InterfaceLayer.createTask(taskC.title, taskC.des, taskC.due, InterfaceLayer.getBoard()); InterfaceLayer.CreateNewTask(taskC.title, taskC.des, taskC.due); errors.error = ""; refresh(); } catch (AlmogException exi) { errors.error = (String)exi.Value; } }
public void TestBadCreation() { try { // note - createnewTask also saves the task. the error would accore when trying to save InterfaceLayer.CreateNewTask("testCre", "task1", new DateTime(2018, 12, 12)); Assert.Fail("saved although bad"); } catch (MileStone4.AlmogException ex) { //good } catch (Exception e) { Assert.Fail(e.Message, new object[] { e }); } }