Exemplo n.º 1
0
 /// <summary>
 /// Creates the expected list for the test cases. If index is out of bounds, don't
 /// bother to modify the list
 /// </summary>
 /// <param name="expectedList"></param>
 /// <param name="itemIdToChange"></param>
 /// <returns></returns>
 private static GGList CreateExpectedList(GGList expectedList, int itemIdToChange)
 {
     AddOriginalDataToList(expectedList);
     if (itemIdToChange > 0 && itemIdToChange <= expectedList.CountGGList())
         expectedList.RemoveGGItemAt(itemIdToChange - 1);
     return expectedList;
 }
Exemplo n.º 2
0
 private static void AddOriginalDataToList(GGList originalList)
 {
     for (int i = 0; i < originalData.Length / 3; i++)
     {
         GGItem item = new GGItem(originalData[i, 0], DateTime.Parse(originalData[i, 1], usCulture), originalData[i, 2]);
         originalList.AddGGItem(item);
     }
 }
Exemplo n.º 3
0
 public static void GenerateAndRunTestCases(string command, int itemIdToChange, string expectedResultMessage, string message)
 {
     GGList originalList = new GGList();
     AddOriginalDataToList(originalList);
     GGList expectedList = new GGList();
     CreateExpectedList(expectedList, itemIdToChange);
     RemoveCommand rmCommand = new RemoveCommand();
     GGResult actualResult = rmCommand.Execute(command, originalList);
     Assert.AreEqual(expectedList, originalList, message);
     Assert.AreEqual(expectedResultMessage, actualResult.GetNotice(), "result message");
 }
Exemplo n.º 4
0
 public static void GenerateAndRunTestCases(string command, string expectedDesc, string expectedTag, DateTime expectedDate, string expectedResultMessage, string message)
 {
     GGList originalList = new GGList();
     AddOriginalDataToList(originalList);
     GGList expectedList = new GGList();
     CreateExpectedList(expectedList, expectedDesc, expectedTag, expectedDate);
     AddCommand addCommand = new AddCommand();
     GGResult actualResult = addCommand.Execute(command, originalList);
     Assert.AreEqual(expectedList, originalList, message);
     Assert.AreEqual(expectedResultMessage, actualResult.GetNotice(), "result message");
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates the expected list for the test cases. If index is out of bounds, don't
 /// bother to modify the list
 /// </summary>
 /// <param name="expectedList"></param>
 /// <param name="itemIdToChange"></param>
 /// <returns></returns>
 private static GGList CreateExpectedList(GGList expectedList, string expectedDesc, string expectedTag, DateTime expectedDate)
 {
     AddOriginalDataToList(expectedList);
     string desc = string.Empty;
     string tag = string.Empty;
     DateTime date = GGItem.DEFAULT_ENDDATE;
     if (expectedDesc == null)
         return expectedList;
     desc = expectedDesc;
     if (expectedTag != null)
         tag = expectedTag;
     if (expectedDate != GGItem.DEFAULT_ENDDATE)
         date = expectedDate;
     expectedList.AddGGItem(new GGItem(desc, date, tag));
     return expectedList;
 }