public void ScheduleListWithEmptyEvent() { #region Initiate DateTime Time; List<string> Event = new List<string>(); List<string> Referee = new List<string>(); string excpectedResult = "den 12 maj 2015 11:45\nGrenar:\n\nDomare:\nAnna\nSara\n\n"; Time = DateTime.ParseExact("2015-05-12 11:45", "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture); Referee.Add("Anna"); Referee.Add("Sara"); Schedule testSchedule = new Schedule(); #endregion #region Test testSchedule.AddContest(Time, Event, Referee); #endregion #region Assert Assert.AreEqual(excpectedResult, testSchedule.ToString()); #endregion }
static void Main(string[] args) { Contest tavling = new Contest(); Contest tavling2 = new Contest(); Schedule season = new Schedule(); Control testContest = new Control(); tavling.Referee.Add("Anders Bertilsson"); tavling.Referee.Add("Hugo Andersson"); tavling.Event.Add("Barr"); tavling.Event.Add("Ringar"); tavling.setTime("2015-01-12 12:45"); tavling2.Referee.Add("Bertil Jönsson"); tavling2.Referee.Add("Jöns Hugosson"); tavling2.Event.Add("Häck"); tavling2.Event.Add("Lina"); tavling2.setTime("2015-01-18 11:30"); if (testContest.TestBeforeAddingToSchedule(tavling.Time, tavling.Event, tavling.Referee)) { season.AddContest(tavling.Time, tavling.Event, tavling.Referee); } if (testContest.TestBeforeAddingToSchedule(tavling2.Time, tavling2.Event, tavling2.Referee)) { season.AddContest(tavling2.Time, tavling2.Event, tavling2.Referee); } Console.WriteLine(season); }
public void SaveContestWithBadRefereeNamesToScheduleWithControll() { #region Initiate Contest testContest = new Contest(); Schedule testSchedule = new Schedule(); Control testControll = new Control(); testContest.setTime("2015-05-12 11:45"); testContest.Event.Add("Barr"); testContest.Event.Add("Trampets"); testContest.Referee.Add("Anna L33t"); testContest.Referee.Add("N00b Klüft"); #endregion #region Test try { if (testControll.TestBeforeAddingToSchedule(testContest.Time, testContest.Event, testContest.Referee)) { testSchedule.AddContest(testContest.Time, testContest.Event, testContest.Referee); } } catch (Exception) { return; } #endregion #region Assert Assert.Fail("Ett undantag kastades."); #endregion }
public void SaveCompleteContestToScheduleWithControll() { #region Initiate Contest testContest = new Contest(); Schedule testSchedule = new Schedule(); Control testControll = new Control(); testContest.setTime("2015-05-12 11:45"); testContest.Event.Add("Barr"); testContest.Event.Add("Trampets"); testContest.Referee.Add("Anna Brämström"); testContest.Referee.Add("Carolina Klüft"); #endregion #region Test try { if (testControll.TestBeforeAddingToSchedule(testContest.Time, testContest.Event, testContest.Referee)) { testSchedule.AddContest(testContest.Time, testContest.Event, testContest.Referee); } } #endregion #region Assert catch (Exception) { Assert.Fail("Ett undantag kastades."); } #endregion }