public void TestOpenMeetMeetMgr() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); MeetMgr mMgr = new MeetMgr(); Meet openedMeet = mMgr.openMeet(testFileName); Console.WriteLine("Opened Meet:"); Console.WriteLine(openedMeet.ToString()); Console.WriteLine("\nControl Meet:"); Console.WriteLine(testMeet.ToString()); bool test = openedMeet.Equals(testMeet); Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public void TestMeetOpens() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); SavingJsonSvcImpl savingImplObject = new SavingJsonSvcImpl(); Meet openedMeet = savingImplObject.openMeet(testFileName); Console.WriteLine("Opened Meet:"); Console.WriteLine(openedMeet.ToString()); Console.WriteLine("\nControl Meet:"); Console.WriteLine(testMeet.ToString()); bool test = openedMeet.Equals(testMeet); Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public void TestStaticAddNewIndividualPerformance() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); Dictionary <string, string> boysNames = new Dictionary <string, string>(); boysNames.Add("BLN", "Baldwin"); boysNames.Add("TJ", "Thomas Jefferson"); boysNames.Add("WHS", "Washington HS"); Dictionary <string, string> girlsNames = new Dictionary <string, string>(); girlsNames.Add("PLM", "Plum"); girlsNames.Add("GWY", "Gateway"); girlsNames.Add("KCH", "Knoch"); Teams teams = new Teams(boysNames, girlsNames); Performance myPerformance1 = new Performance("A", "AA", 1.1m); Performance myPerformance2 = new Performance("B", "BB", 2.2m); Performance myPerformance3 = new Performance("C", "CC", 3.3m); Performance myPerformance4 = new Performance("D", "AA", 4.1m); Performance myPerformance5 = new Performance("E", "BB", 5.2m); Performance myPerformance6 = new Performance("F", "CC", 6.3m); Performance myPerformance7 = new Performance("G", "DD", 4.4m); List <Performance> myPerformancesA = new List <Performance>(); myPerformancesA.Add(myPerformance1); myPerformancesA.Add(myPerformance2); myPerformancesA.Add(myPerformance3); List <Performance> myPerformancesB = new List <Performance>(); myPerformancesB.Add(myPerformance4); myPerformancesB.Add(myPerformance5); myPerformancesB.Add(myPerformance6); List <Performance> myPerformancesC = new List <Performance>(); myPerformancesC.Add(myPerformance7); Dictionary <string, List <Performance> > originalList = new Dictionary <string, List <Performance> >(); originalList.Add("Boy's 100", myPerformancesA); originalList.Add("Boy's 200", myPerformancesB); Dictionary <string, List <Performance> > newComparableList = new Dictionary <string, List <Performance> >(); newComparableList.Add("Boy's 100", myPerformancesA); newComparableList.Add("Boy's 200", myPerformancesB); newComparableList.Add("Boy's 400", myPerformancesC); Meet meet1 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams, originalList); Meet meet2 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams, newComparableList); DataEntrySvcImpl DESI = new DataEntrySvcImpl(); meet1.performances = meet1.performances.AddPerformanceToEvent("Boy's 400", myPerformancesC); Console.WriteLine("originalList:"); foreach (KeyValuePair <string, List <Performance> > kvp in originalList) { foreach (Performance i in kvp.Value) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, i.ToString()); } } Console.WriteLine("\nnewComparableList:"); foreach (KeyValuePair <string, List <Performance> > kvp in newComparableList) { foreach (Performance i in kvp.Value) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, i.ToString()); } } bool test = meet1.Equals(meet2); Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public void TestEqualsMethod() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); bool test = true; Performance myPerformance1 = new Performance("A", "AA", 1.1m); Performance myPerformance2 = new Performance("B", "BB", 2.2m); Performance myPerformance3 = new Performance("C", "CC", 3.3m); Performance myPerformance4 = new Performance("D", "AA", 4.1m); Performance myPerformance5 = new Performance("E", "BB", 5.2m); Performance myPerformance6 = new Performance("F", "CC", 6.3m); List <Performance> myPerformancesA = new List <Performance>(); myPerformancesA.Add(myPerformance1); myPerformancesA.Add(myPerformance2); List <Performance> myPerformancesB = new List <Performance>(); myPerformancesB.Add(myPerformance3); myPerformancesB.Add(myPerformance4); List <Performance> myPerformancesC = new List <Performance>(); myPerformancesC.Add(myPerformance5); myPerformancesC.Add(myPerformance6); Dictionary <string, List <Performance> > myEventsA = new Dictionary <string, List <Performance> >(); myEventsA.Add("Boy's 100", myPerformancesA); myEventsA.Add("Boy's 200", myPerformancesB); Dictionary <string, List <Performance> > myEventsB = new Dictionary <string, List <Performance> >(); myEventsB.Add("Boy's 100", myPerformancesA); myEventsB.Add("Boy's 200", myPerformancesB); Dictionary <string, List <Performance> > myEventsC = new Dictionary <string, List <Performance> >(); myEventsC.Add("Boy's 100", myPerformancesB); myEventsC.Add("Boy's 200", myPerformancesC); //Teams Dictionary <string, string> boysNamesA = new Dictionary <string, string>(); boysNamesA.Add("BLN", "Baldwin"); boysNamesA.Add("TJ", "Thomas Jefferson"); boysNamesA.Add("WHS", "Washington HS"); Dictionary <string, string> boysNamesB = new Dictionary <string, string>(); boysNamesB.Add("BLN", "Baldwin"); boysNamesB.Add("TJ", "Thomas Jefferson"); boysNamesB.Add("WHS", "Washington HS"); Dictionary <string, string> boysNamesC = new Dictionary <string, string>(); boysNamesC.Add("BLN", "Baldwin"); boysNamesC.Add("TJ", "Thomas Jefferson"); boysNamesC.Add("WHS", "Washington"); Dictionary <string, string> boysNamesD = new Dictionary <string, string>(); boysNamesD.Add("BLN", "Baldwin"); boysNamesD.Add("TJ", "Thomas Jefferson"); boysNamesD.Add("BHS", "Washington HS"); Dictionary <string, string> girlsNamesA = new Dictionary <string, string>(); girlsNamesA.Add("PLM", "Plum"); girlsNamesA.Add("GWY", "Gateway"); girlsNamesA.Add("KCH", "Knoch"); Dictionary <string, string> girlsNamesB = new Dictionary <string, string>(); girlsNamesB.Add("PLM", "Plum"); girlsNamesB.Add("GWY", "Gateway"); girlsNamesB.Add("KCH", "Knoch"); Dictionary <string, string> girlsNamesC = new Dictionary <string, string>(); girlsNamesC.Add("PLM", "Plum"); girlsNamesC.Add("GWY", "Gateway"); girlsNamesC.Add("KCH", "Ohio HS"); Dictionary <string, string> girlsNamesD = new Dictionary <string, string>(); girlsNamesD.Add("PLM", "Plum"); girlsNamesD.Add("GWY", "Gateway"); girlsNamesD.Add("KOH", "Knoch"); Teams teams1 = new Teams(boysNamesA, girlsNamesA); Teams teams2 = new Teams(boysNamesB, girlsNamesB); Teams teams3 = new Teams(boysNamesC, girlsNamesA); Teams teams4 = new Teams(boysNamesA, girlsNamesC); Teams teams5 = new Teams(boysNamesD, girlsNamesA); Teams teams6 = new Teams(boysNamesA, girlsNamesD); //Meet to test Meet meet1 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams1, myEventsA); //Equal Meet Meet meet2 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams2, myEventsB); //Differnet Date Meet meet3 = new Meet(new DateTime(2017, 04, 12), "Baldwin HS", "Windy", teams1, myEventsA); //Different Location Meet meet4 = new Meet(new DateTime(2017, 04, 13), "Trinity HS", "Windy", teams1, myEventsA); //Different Weather Conditions Meet meet5 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Cloudy", teams1, myEventsA); //Different Boy's Teams Meet meet6 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams3, myEventsA); //Differnet Girls's Teams Meet meet7 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams4, myEventsA); //Different Boy's Abbr Meet meet8 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams5, myEventsA); //Different Girl's Abbr Meet meet9 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams6, myEventsA); //Different Results Meet meet10 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams1, myEventsC); //No Results Meet meet11 = new Meet(new DateTime(2017, 04, 13), "Baldwin HS", "Windy", teams1); if (!meet1.Equals(meet2)) { test = false; Console.WriteLine("meet1 does not equal meet2"); } if (meet1.Equals(meet3)) { test = false; Console.WriteLine("meet1 equals meet3"); } if (meet1.Equals(meet4)) { test = false; Console.WriteLine("meet1 equals meet4"); } if (meet1.Equals(meet5)) { test = false; Console.WriteLine("meet1 equals meet5"); } if (meet1.Equals(meet6)) { test = false; Console.WriteLine("meet1 equals meet6"); } if (meet1.Equals(meet7)) { test = false; Console.WriteLine("meet1 equals meet7"); } if (meet1.Equals(meet8)) { test = false; Console.WriteLine("meet1 equals meet8"); } if (meet1.Equals(meet9)) { test = false; Console.WriteLine("meet1 equals meet9"); } if (meet1.Equals(meet10)) { test = false; Console.WriteLine("meet1 equals meet10"); } if (meet1.Equals(meet11)) { test = false; Console.WriteLine("meet1 equals meet11"); } Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }