public void TestEqualsMethod() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); bool test = true; IndEvent controlIndEvent = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent equalIndEvent = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent diffTeam1 = new IndEvent("WH", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent diffTeam2 = new IndEvent("PLM", "WH", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent diffFirstPlacePts = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P4", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent diffSecondPlacePts = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.45"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent diffThirdPlacePts = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.1m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent diffTotalPts = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 9.0m, 0.0m); IndEvent nullIndEvent = new IndEvent(); if (!controlIndEvent.Equals(equalIndEvent)) { test = false; Console.WriteLine("equalIndEvent was not equal to controlIndEvent"); } if (controlIndEvent.Equals(diffTeam1)) { test = false; Console.WriteLine("diffTeam1 was equal to controlIndEvent"); } if (controlIndEvent.Equals(diffTeam2)) { test = false; Console.WriteLine("diffTeam2 was equal to controlIndEvent"); } if (controlIndEvent.Equals(diffFirstPlacePts)) { test = false; Console.WriteLine("diffFirstPlacePts was equal to controlIndEvent"); } if (controlIndEvent.Equals(diffSecondPlacePts)) { test = false; Console.WriteLine("diffSecondPlacePts was equal to controlIndEvent"); } if (controlIndEvent.Equals(diffThirdPlacePts)) { test = false; Console.WriteLine("diffThirdPlacePts was equal to controlIndEvent"); } if (controlIndEvent.Equals(diffTotalPts)) { test = false; Console.WriteLine("diffTotalPts was equal to controlIndEvent"); } if (controlIndEvent.Equals(nullIndEvent)) { test = false; Console.WriteLine("nullIndEvent was equal to controlIndEvent"); } Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public void TestToStringMethod() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); IndEvent myIndEvent = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); string strIndEvent = myIndEvent.ToString(); Console.WriteLine("My string:" + Environment.NewLine + Environment.NewLine); Console.WriteLine(strIndEvent + Environment.NewLine); Console.WriteLine("Expecting:" + Environment.NewLine + Environment.NewLine); Console.WriteLine("First Place: P1 - PLM: 11.3" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: P2 - PLM: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine + "Third Place: G1 - GWY: 11.5" + Environment.NewLine + "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine + "Total: PLM: 8 GWY: 1"); Assert.AreEqual(strIndEvent, "First Place: P1 - PLM: 11.3" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: P2 - PLM: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine + "Third Place: G1 - GWY: 11.5" + Environment.NewLine + "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine + "Total: PLM: 8 GWY: 1", GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public void TestDefaultConstructor() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); IndEvent blankEvent = new IndEvent(); Assert.AreEqual(blankEvent != null, true, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public void TestParameterizedConstructor() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); bool test = true; IndEvent myIndEvent = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); if (myIndEvent == null) { test = false; Console.WriteLine("myIndEvent is null"); } if (myIndEvent.team1 != "PLM") { test = false; Console.WriteLine("team1 does not have the correct value"); } if (myIndEvent.team2 != "GWY") { test = false; Console.WriteLine("team2 does not have the correct value"); } if (!myIndEvent.points[0].Equals(new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"))) { test = false; Console.WriteLine("firstPlacePts does not have the correct value"); } if (!myIndEvent.points[1].Equals(new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"))) { test = false; Console.WriteLine("secondPlacePts does not have the correct value"); } if (!myIndEvent.points[2].Equals(new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"))) { test = false; Console.WriteLine("thirdPlacePts does not have the correct value"); } if (myIndEvent.team1Total != 8.0m) { test = false; Console.WriteLine("team1Total does not have the correct value"); } if (myIndEvent.team2Total != 1.0m) { test = false; Console.WriteLine("team2Total does not have the correct value"); } Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
/// <summary> /// Tests parameterized constructor /// </summary> /// <remarks>Each attribute is tested individually for accuracy</remarks> public void TestParameterizedConstructor() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); bool test = true; IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m); Dictionary <string, IndEvent> indEvents = new Dictionary <string, IndEvent>(); indEvents.Add("Boy's 100", indEvent1); indEvents.Add("Boy's 200", indEvent2); RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m); RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m); Dictionary <string, RelayEvent> relayEvents = new Dictionary <string, RelayEvent>(); relayEvents.Add("Boy's 4x100", relayEvent1); relayEvents.Add("Boy's 4x400", relayEvent2); OverallScore myOverallScore = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEvents, relayEvents); if (myOverallScore == null) { test = false; Console.WriteLine("myOverallScore is null"); } if (!myOverallScore.team1.Equals(Tuple.Create("PLM", "Plum", 10.0m))) { test = false; Console.WriteLine("team1 does not have the correct value"); } if (!myOverallScore.team2.Equals(Tuple.Create("GWY", "Gateway", 6.0m))) { test = false; Console.WriteLine("team2 does not have the correct value"); } if (!myOverallScore.indEvents.OrderBy(r => r.Key).SequenceEqual(indEvents.OrderBy(r => r.Key))) { test = false; Console.WriteLine("indEvents does not have the correct value"); } if (!myOverallScore.relayEvents.OrderBy(r => r.Key).SequenceEqual(relayEvents.OrderBy(r => r.Key))) { test = false; Console.WriteLine("relayEvents does not have the correct value"); } Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public OverallScore AddEvent(OverallScore scores, string eventName, IndEvent eventToAdd) { try { IScoringSvc scoringSvc = (IScoringSvc)GetService(typeof(IScoringSvc).Name); OverallScore os = scoringSvc.AddEvent(scores, eventName, eventToAdd); return(os); } catch (Exception e) //Implement more specific Exceptions later { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); return(null); } }
public IndEvent CalculateRunningEvent(string team1Abbr, string team2Abbr, List <Performance> perf) { try { IScoringSvc scoringSvc = (IScoringSvc)GetService(typeof(IScoringSvc).Name); IndEvent ie = scoringSvc.CalculateRunningEvent(team1Abbr, team2Abbr, perf); return(ie); } catch (Exception e) //Implement more specific Exceptions later { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); return(null); } }
public void TestParameterizedConstructorsAreEqual() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); IndEvent indEvent1 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 8.0m, 1.0m); Console.WriteLine(1); EventPoints[] eventPoints = { new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5") }; Console.WriteLine(2); IndEvent indEvent2 = new IndEvent("TM1", "TM2", eventPoints, 8.0m, 1.0m); Console.WriteLine(3); Assert.AreEqual(indEvent1, indEvent2, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
/// <summary> /// Interface for calculating The overall score of a meet /// </summary> /// <param name="scores">Overall scores</param> /// <param name="gender">string to hold what gender the meet is, boy's or girl's</param> /// <returns>OverallScore object that holds accurate overall score points</returns> public OverallScore CalculateTotal(OverallScore scores, string gender) { decimal totalPointsTeam1 = 0; decimal totalPointsTeam2 = 0; IndEvent tempIndEvent = new IndEvent(); RelayEvent tempRelayEvent = new RelayEvent(); string[] validIndEvents = { "100", "200", "400", "800", "1600", "3200", "HH", "300H", "LJ", "TJ", "HJ", "PV", "ShotPut", "Discus", "Javelin" }; for (int i = 0; i < validIndEvents.Length; i++) { if (scores != null && scores.indEvents != null) { scores.indEvents.TryGetValue(gender + "'s " + validIndEvents[i], out tempIndEvent); if (tempIndEvent != null) { totalPointsTeam1 += tempIndEvent.team1Total; totalPointsTeam2 += tempIndEvent.team2Total; } } } //DO THE SAME FOR RELAY EVENTS string[] validRelayEvents = { "4x100", "4x400", "4x800" }; for (int i = 0; i < validRelayEvents.Length; i++) { if (scores != null && scores.relayEvents != null) { scores.relayEvents.TryGetValue(gender + "'s " + validRelayEvents[i], out tempRelayEvent); if (tempRelayEvent != null) { totalPointsTeam1 += tempRelayEvent.team1Total; totalPointsTeam2 += tempRelayEvent.team2Total; } } } scores.team1Points = totalPointsTeam1; scores.team2Points = totalPointsTeam2; return(scores); }
public void TestCreateMeetResultsDoc() { IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m); Dictionary <string, IndEvent> indEvents = new Dictionary <string, IndEvent>(); indEvents.Add("Boy's 100", indEvent1); indEvents.Add("Boy's 200", indEvent2); RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m); RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m); Dictionary <string, RelayEvent> relayEvents = new Dictionary <string, RelayEvent>(); relayEvents.Add("Boy's 4x100", relayEvent1); relayEvents.Add("Boy's 4x400", relayEvent2); OverallScore myOverallScore = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEvents, relayEvents); PrintoutDocXSvcImpl pdxi = new PrintoutDocXSvcImpl(); pdxi.CreateMeetResultsDoc("Boy's", new DateTime(01, 01, 2000), "Anywhere", myOverallScore); }
/// <summary> /// Implementation for adding an indEvent to an OverallScore object /// </summary> /// <param name="scores">Overall scores</param> /// <param name="eventName">Name of the event being added</param> /// <param name="eventToAdd">Data for the event being added</param> /// <returns>OverallScore with the event added</returns> public OverallScore AddEvent(OverallScore scores, string eventName, IndEvent eventToAdd) { if (scores == null) { scores = new OverallScore(); } if (scores.indEvents == null) { scores.indEvents = new Dictionary <string, IndEvent>(); } if (scores.indEvents != null && scores.indEvents.ContainsKey(eventName)) { scores.indEvents[eventName] = eventToAdd; } else { scores.indEvents.Add(eventName, eventToAdd); } return(scores); }
public void TestEqualsMethod() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); bool test = true; IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m); IndEvent indEvent3 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P7", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m); Dictionary <string, IndEvent> indEventsA = new Dictionary <string, IndEvent>(); indEventsA.Add("Boy's 100", indEvent1); indEventsA.Add("Boy's 200", indEvent2); Dictionary <string, IndEvent> indEventsB = new Dictionary <string, IndEvent>(); indEventsB.Add("Boy's 100", indEvent1); indEventsB.Add("Boy's 200", indEvent3); RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m); RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m); RelayEvent relayEvent3 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "450"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m); Dictionary <string, RelayEvent> relayEventsA = new Dictionary <string, RelayEvent>(); relayEventsA.Add("Boy's 4x100", relayEvent1); relayEventsA.Add("Boy's 4x400", relayEvent2); Dictionary <string, RelayEvent> relayEventsB = new Dictionary <string, RelayEvent>(); relayEventsB.Add("Boy's 4x100", relayEvent1); relayEventsB.Add("Boy's 4x400", relayEvent3); OverallScore control = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA); OverallScore equal = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA); OverallScore diffTeam1 = new OverallScore(Tuple.Create("PLU", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA); OverallScore diffTeam2 = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gate HS"), indEventsA, relayEventsA); OverallScore diffIndEvents = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsB, relayEventsA); OverallScore diffRelayEvents = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsB); if (!control.Equals(equal)) { test = false; Console.WriteLine("equal was not equal to control"); } if (control.Equals(diffTeam1)) { test = false; Console.WriteLine("diffTeam1 was equal to control"); } if (control.Equals(diffTeam2)) { test = false; Console.WriteLine("diffTeam2 was equal to control"); } if (control.Equals(diffIndEvents)) { test = false; Console.WriteLine("diffIndEvents was equal to control"); } if (control.Equals(diffRelayEvents)) { test = false; Console.WriteLine("diffRelayEvents was equal to control"); } Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
public void TestToStringMethod() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m); IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m); Dictionary <string, IndEvent> indEventsA = new Dictionary <string, IndEvent>(); indEventsA.Add("Boy's 100", indEvent1); indEventsA.Add("Boy's 200", indEvent2); RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m); RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m); Dictionary <string, RelayEvent> relayEventsA = new Dictionary <string, RelayEvent>(); relayEventsA.Add("Boy's 4x100", relayEvent1); relayEventsA.Add("Boy's 4x400", relayEvent2); OverallScore myOverallScore = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA, 10.0m, 6.0m); string strOverallScore = myOverallScore.ToString(); Console.WriteLine("My string:" + Environment.NewLine + Environment.NewLine); Console.WriteLine(strOverallScore + Environment.NewLine); Console.WriteLine("Expecting:" + Environment.NewLine + Environment.NewLine); Console.WriteLine("Plum - PLM: 10.0" + Environment.NewLine + "Gateway - GWY: 6.0" + Environment.NewLine + Environment.NewLine + "Boy's 100" + Environment.NewLine + "First Place: P1 - PLM: 11.3" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: P2 - PLM: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine + "Third Place: G1 - GWY: 11.5" + Environment.NewLine + "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine + "Total: PLM: 8 GWY: 1" + Environment.NewLine + "Boy's 200" + Environment.NewLine + "First Place: P5 - PLM: 11.2" + Environment.NewLine + "First Place Pts: PLM: 0 GWY: 5" + Environment.NewLine + "Second Place: P2 - PLM: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine + "Third Place: G1 - GWY: 11.5" + Environment.NewLine + "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine + "Total: PLM: 3 GWY: 6" + Environment.NewLine + "Boy's 4x100" + Environment.NewLine + "First Place: A - PLM: 11.3" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: A - GWY: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine + "Total: PLM: 5 GWY: 0" + Environment.NewLine + "Boy's 4x400" + Environment.NewLine + "First Place: A - PLM: 400" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: A - GWY: 500" + Environment.NewLine + "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine + "Total: PLM: 5 GWY: 0" + Environment.NewLine); Assert.AreEqual(strOverallScore, "Plum - PLM: 10.0" + Environment.NewLine + "Gateway - GWY: 6.0" + Environment.NewLine + Environment.NewLine + "Boy's 100" + Environment.NewLine + "First Place: P1 - PLM: 11.3" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: P2 - PLM: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine + "Third Place: G1 - GWY: 11.5" + Environment.NewLine + "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine + "Total: PLM: 8 GWY: 1" + Environment.NewLine + "Boy's 200" + Environment.NewLine + "First Place: P5 - PLM: 11.2" + Environment.NewLine + "First Place Pts: PLM: 0 GWY: 5" + Environment.NewLine + "Second Place: P2 - PLM: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine + "Third Place: G1 - GWY: 11.5" + Environment.NewLine + "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine + "Total: PLM: 3 GWY: 6" + Environment.NewLine + "Boy's 4x100" + Environment.NewLine + "First Place: A - PLM: 11.3" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: A - GWY: 11.4" + Environment.NewLine + "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine + "Total: PLM: 5 GWY: 0" + Environment.NewLine + "Boy's 4x400" + Environment.NewLine + "First Place: A - PLM: 400" + Environment.NewLine + "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine + "Second Place: A - GWY: 500" + Environment.NewLine + "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine + "Total: PLM: 5 GWY: 0" + Environment.NewLine, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }
/// <summary> /// Helper Method for Calculating Individual Event (Not Relay) /// </summary> /// <param name="team1Abbr">Abbreviation for Team #1</param> /// <param name="team2Abbr">Abbreviation for Team #2</param> /// <param name="teams1and2">Sorted List (Ascending or Descending, depending on event) of Performances for Teams 1 & 2</param> /// <returns>IndEvent, which holds all information ragarding this event's points</returns> /// <remarks>Does NOT include a way to determine Ties for Field Events. This must be implemented later by another Method</remarks> public static IndEvent CalculateIndEventInOrder(string team1Abbr, string team2Abbr, List <Performance> teams1and2) { // //gather info for 1st 2nd and 3rd // IndEvent eventToReturn = new IndEvent(); eventToReturn.team1 = team1Abbr; eventToReturn.team2 = team2Abbr; List <int> firstPlaceHeats = new List <int>(); List <int> secondPlaceHeats = new List <int>(); List <int> thirdPlaceHeats = new List <int>(); decimal firstPlacePerf = 0; decimal secondPlacePerf = 0; decimal thirdPlacePerf = 0; //First place performance if (teams1and2.Count > 0) { firstPlacePerf = teams1and2[0].performance; firstPlaceHeats.Add(teams1and2[0].heatNum); for (int i = 1; i < teams1and2.Count; i++) { if (teams1and2[i].performance == firstPlacePerf) { //check heatnum if (firstPlaceHeats.Contains(teams1and2[i].heatNum)) //check if it is already a 2nd item { if (secondPlaceHeats.Contains(teams1and2[i].heatNum)) //check if it is already a 3rd item { if (!thirdPlaceHeats.Contains(teams1and2[i].heatNum)) { thirdPlaceHeats.Add(teams1and2[i].heatNum); thirdPlacePerf = teams1and2[0].performance; } } else { secondPlaceHeats.Add(teams1and2[i].heatNum); secondPlacePerf = teams1and2[0].performance; } } else { firstPlaceHeats.Add(teams1and2[i].heatNum); } } } //Check if 3 or more firsts //Should have no 2nds or 3rds if (firstPlaceHeats.Count >= 3) { secondPlaceHeats.Clear(); thirdPlaceHeats.Clear(); secondPlacePerf = 0; thirdPlacePerf = 0; } //Check if 2 firsts //Should have no 2nd, its should become third if (firstPlaceHeats.Count == 2) { thirdPlaceHeats.Clear(); thirdPlaceHeats.AddRange(secondPlaceHeats); secondPlaceHeats.Clear(); thirdPlacePerf = secondPlacePerf; secondPlacePerf = 0; } //Check if 2 or more seconds //Should have no 3rds if (secondPlaceHeats.Count >= 2) { thirdPlaceHeats.Clear(); thirdPlacePerf = 0; } //Check if second place was not already found, at least 2 performances, and not more than one firstPlace if (!(secondPlaceHeats.Count > 0 || teams1and2.Count <= 1 || firstPlaceHeats.Count > 1)) { secondPlacePerf = teams1and2[1].performance; secondPlaceHeats.Add(teams1and2[1].heatNum); for (int i = 2; i < teams1and2.Count; i++) { if (teams1and2[i].performance == secondPlacePerf) { //check heatnum if (secondPlaceHeats.Contains(teams1and2[i].heatNum)) //check if it is already a 3rd item { if (!thirdPlaceHeats.Contains(teams1and2[i].heatNum)) { thirdPlaceHeats.Add(teams1and2[i].heatNum); thirdPlacePerf = teams1and2[i].performance; } } else { secondPlaceHeats.Add(teams1and2[i].heatNum); secondPlacePerf = teams1and2[i].performance; } } } } else { //This means that there were either 2 or more firsts, or second place was already found (same time + same heat) } //Check if third place was not already found and at least 3 performances if (!(thirdPlaceHeats.Count > 0 || teams1and2.Count <= 2 || secondPlaceHeats.Count + firstPlaceHeats.Count > 2)) { thirdPlacePerf = teams1and2[2].performance; thirdPlaceHeats.Add(teams1and2[2].heatNum); for (int i = 3; i < teams1and2.Count; i++) { if (teams1and2[i].performance == thirdPlacePerf) { //check heatnum if (!thirdPlaceHeats.Contains(teams1and2[i].heatNum)) { thirdPlaceHeats.Add(teams1and2[i].heatNum); thirdPlacePerf = teams1and2[i].performance; } } } } else { //Third place should not be calculated because of ties with 1st and/or 2nd } } else //No performances for either team. Uncontested Event { //null object. needs created here Console.WriteLine("No performances for this event. Returning null IndEvent"); eventToReturn = new IndEvent(); //Console.WriteLine("Leaving " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); Console.WriteLine("Leaving " + MethodBase.GetCurrentMethod().DeclaringType + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); return(eventToReturn); } //Check for redundancy, or in wrong place. //This code is also above. MAY be needed again. //Check if 3 or more firsts //Should have no 2nds or 3rds /*if (firstPlaceHeats.Count >= 3) * { * secondPlaceHeats.Clear(); * thirdPlaceHeats.Clear(); * secondPlacePerf = 0; * thirdPlacePerf = 0; * } * * //Check if 2 firsts * //Should have no 2nd, its should become third * if (firstPlaceHeats.Count == 2) * { * thirdPlaceHeats.Clear(); * thirdPlaceHeats.AddRange(secondPlaceHeats); * secondPlaceHeats.Clear(); * thirdPlacePerf = secondPlacePerf; * secondPlacePerf = 0; * } * * //Check if 2 or more seconds * //Should have no 3rds * if (secondPlaceHeats.Count >= 2) * { * thirdPlaceHeats.Clear(); * thirdPlacePerf = 0; * }*/ //End code check // //Populate IndEvent object // //Algorithm used to resort list if multiple same performances in same and different heats //Assumes list was originally organized by heats bool stopLoop = false; do { stopLoop = false; for (int i = 1; i < teams1and2.Count - 1; i++) { if (teams1and2[i - 1].performance == teams1and2[i].performance && teams1and2[i - 1].heatNum == teams1and2[i].heatNum && teams1and2[i].performance == teams1and2[i + 1].performance && teams1and2[i].heatNum != teams1and2[i + 1].heatNum) { Performance temp = teams1and2[i]; teams1and2[i] = teams1and2[i + 1]; teams1and2[i + 1] = temp; stopLoop = true; } } } while (stopLoop); //ints used if dividing by them near the end of the method //Avoids Divide by zero errors because the ints in the Lists are about to be removed int numFirstPlaces = firstPlaceHeats.Count; int numSecondPlaces = secondPlaceHeats.Count; int numThirdPlaces = thirdPlaceHeats.Count; //Use this to convert into strings for EventPoints objects DataEntrySvcImpl DESI = new DataEntrySvcImpl(); EventPoints firstEventPoints = new EventPoints(); EventPoints secondEventPoints = new EventPoints(); EventPoints thirdEventPoints = new EventPoints(); //first place EventPoints if (firstPlacePerf != 0) { firstEventPoints.performance = DESI.ConvertToTimedData(firstPlacePerf); if (firstPlaceHeats.Count > 1) { Console.WriteLine(numFirstPlaces + "-Way Tie for 1st"); firstEventPoints.athleteName = "TIE"; firstEventPoints.schoolName = "TIE"; //Calculate Tie info //Two-Way Tie if (firstPlaceHeats.Count == 2) { foreach (Performance p in teams1and2) { if (p.performance == firstPlacePerf && firstPlaceHeats.Contains(p.heatNum)) { //test taking out p.heatNum here //Not sure if this is correct firstPlaceHeats.Remove(p.heatNum); if (p.schoolName == team1Abbr) { firstEventPoints.team1Pts += 4; } else if (p.schoolName == team2Abbr) { firstEventPoints.team2Pts += 4; } else { Console.WriteLine("ERROR! This code should be unreachable!"); throw new TeamNotFoundException(p.schoolName + " does not equal " + team1Abbr + " or " + team2Abbr); } } } } //More than Two-Way Tie else if (firstPlaceHeats.Count >= 2) { foreach (Performance p in teams1and2) { if (p.performance == firstPlacePerf && firstPlaceHeats.Contains(p.heatNum)) { //test taking out p.heatNum here //Not sure if this is correct firstPlaceHeats.Remove(p.heatNum); if (p.schoolName == team1Abbr) { firstEventPoints.team1Pts += (9.0m / numFirstPlaces); } else if (p.schoolName == team2Abbr) { firstEventPoints.team2Pts += (9.0m / numFirstPlaces); } else { Console.WriteLine("ERROR! This code should be unreachable!"); throw new TeamNotFoundException(p.schoolName + " does not equal " + team1Abbr + " or " + team2Abbr); } } } } } else { //Populate regular non-tie info firstEventPoints.athleteName = teams1and2[0].athleteName; firstEventPoints.schoolName = teams1and2[0].schoolName; if (firstEventPoints.schoolName == team1Abbr) { firstEventPoints.team1Pts = 5; firstEventPoints.team2Pts = 0; } else if (firstEventPoints.schoolName == team2Abbr) { firstEventPoints.team1Pts = 0; firstEventPoints.team2Pts = 5; } else { Console.WriteLine("ERROR! This code should be unreachable!"); throw new TeamNotFoundException(firstEventPoints.schoolName + " does not equal " + team1Abbr + " or " + team2Abbr); } } } else { firstEventPoints.performance = ""; firstEventPoints.athleteName = ""; firstEventPoints.schoolName = ""; firstEventPoints.team1Pts = 0; firstEventPoints.team2Pts = 0; } //secondplace EventPoints if (secondPlacePerf != 0) { secondEventPoints.performance = DESI.ConvertToTimedData(secondPlacePerf); if (secondPlaceHeats.Count > 1) { Console.WriteLine(numSecondPlaces + "-Way Tie for 2nd"); secondEventPoints.athleteName = "TIE"; secondEventPoints.schoolName = "TIE"; //Calculate Tie info foreach (Performance p in teams1and2) { if (p.performance == secondPlacePerf && secondPlaceHeats.Contains(p.heatNum)) { //test taking out p.heatNum here //Not sure if this is correct secondPlaceHeats.Remove(p.heatNum); if (p.schoolName == team1Abbr) { secondEventPoints.team1Pts += (4.0m / numSecondPlaces); } else if (p.schoolName == team2Abbr) { secondEventPoints.team2Pts += (4.0m / numSecondPlaces); } else { Console.WriteLine("ERROR! This code should be unreachable!"); throw new TeamNotFoundException(p.schoolName + " does not equal " + team1Abbr + " or " + team2Abbr); } } } } else { //Populate regular non-tie info for (int i = 1; i < teams1and2.Count; i++) { if (teams1and2[i].performance == secondPlacePerf) { secondEventPoints.athleteName = teams1and2[i].athleteName; secondEventPoints.schoolName = teams1and2[i].schoolName; break; //break added, same perf same heat error without } } if (secondEventPoints.schoolName == team1Abbr) { secondEventPoints.team1Pts = 3; secondEventPoints.team2Pts = 0; } else if (secondEventPoints.schoolName == team2Abbr) { secondEventPoints.team1Pts = 0; secondEventPoints.team2Pts = 3; } else { Console.WriteLine("ERROR! Second Place Points being assigned to an incorrect team name"); throw new TeamNotFoundException(secondEventPoints.schoolName + " does not equal " + team1Abbr + " or " + team2Abbr); } } } else { secondEventPoints.performance = ""; secondEventPoints.athleteName = ""; secondEventPoints.schoolName = ""; secondEventPoints.team1Pts = 0; secondEventPoints.team2Pts = 0; } //thirdplace EventPoints if (thirdPlacePerf != 0 && numFirstPlaces + numSecondPlaces < 3) { thirdEventPoints.performance = DESI.ConvertToTimedData(thirdPlacePerf); if (thirdPlaceHeats.Count > 1) { Console.WriteLine(numThirdPlaces + "-Way Tie for 3rd"); thirdEventPoints.athleteName = "TIE"; thirdEventPoints.schoolName = "TIE"; //Calculate Tie info foreach (Performance p in teams1and2) { if (p.performance == thirdPlacePerf && thirdPlaceHeats.Contains(p.heatNum)) { //test taking out p.heatNum here //Not sure if this is correct thirdPlaceHeats.Remove(p.heatNum); if (p.schoolName == team1Abbr) { thirdEventPoints.team1Pts += (1.0m / numThirdPlaces); } else if (p.schoolName == team2Abbr) { thirdEventPoints.team2Pts += (1.0m / numThirdPlaces); } else { Console.WriteLine("ERROR! This code should be unreachable!"); throw new TeamNotFoundException(p.schoolName + " does not equal " + team1Abbr + " or " + team2Abbr); } } } } else { //Populate regular non-tie info for (int i = 2; i < teams1and2.Count; i++) { if (teams1and2[i].performance == thirdPlacePerf) //if (teams1and2[i].performance == thirdPlacePerf && thirdPlaceHeats.Contains(teams1and2[i].heatNum)) //Changed { thirdEventPoints.athleteName = teams1and2[i].athleteName; thirdEventPoints.schoolName = teams1and2[i].schoolName; break; //break added, same perf same heat error without } } if (thirdEventPoints.schoolName == team1Abbr) { thirdEventPoints.team1Pts = 1; thirdEventPoints.team2Pts = 0; } else if (thirdEventPoints.schoolName == team2Abbr) { thirdEventPoints.team1Pts = 0; thirdEventPoints.team2Pts = 1; } else { Console.WriteLine("ERROR! Third Place Points being assigned to an incorrect team name"); throw new TeamNotFoundException(thirdEventPoints.schoolName + " does not equal " + team1Abbr + " or " + team2Abbr); } } } else { thirdEventPoints.performance = ""; thirdEventPoints.athleteName = ""; thirdEventPoints.schoolName = ""; thirdEventPoints.team1Pts = 0; thirdEventPoints.team2Pts = 0; } //Populate points totals eventToReturn.points[0] = firstEventPoints; eventToReturn.points[1] = secondEventPoints; eventToReturn.points[2] = thirdEventPoints; eventToReturn.team1Total = firstEventPoints.team1Pts + secondEventPoints.team1Pts + thirdEventPoints.team1Pts; eventToReturn.team2Total = firstEventPoints.team2Pts + secondEventPoints.team2Pts + thirdEventPoints.team2Pts; // //return IndEvent Object // Console.WriteLine("Leaving " + MethodBase.GetCurrentMethod().DeclaringType + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); return(eventToReturn); }
public void TestValidateMethod() { Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name); bool test = true; IndEvent control = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 8.0m, 1.0m); IndEvent team1PtsDontMatch = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 7.0m, 1.0m); IndEvent team2PtsDontMatch = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 8.0m, 0.0m); IndEvent totalAbove9 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 3.0m, "Athlete3", "TM2", "11.5"), 8.0m, 3.0m); IndEvent noNameTeam1 = new IndEvent("", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 8.0m, 1.0m); IndEvent noNameTeam2 = new IndEvent("TM1", "", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 8.0m, 1.0m); IndEvent nullNameTeam1 = new IndEvent("TM1", "TM2", new EventPoints(0.0m, 0.0m, "", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 3.0m, 1.0m); IndEvent nullNameTeam2 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(0.0m, 0.0m, "", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 5.0m, 1.0m); IndEvent nullNameTeam3 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 0.0m, "", "TM2", "11.5"), 8.0m, 0.0m); IndEvent noNameWithPtsTeam1 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "", "", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 8.0m, 1.0m); IndEvent noNameWithPtsTeam2 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "", "", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 8.0m, 1.0m); IndEvent noNameWithPtsTeam3 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "", "", "11.5"), 8.0m, 1.0m); IndEvent nameWithNoPtsTeam1 = new IndEvent("TM1", "TM2", new EventPoints(0.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 3.0m, 1.0m); IndEvent nameWithNoPtsTeam2 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(0.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 1.0m, "Athlete3", "TM2", "11.5"), 5.0m, 1.0m); IndEvent nameWithNoPtsTeam3 = new IndEvent("TM1", "TM2", new EventPoints(5.0m, 0.0m, "Athlete1", "TM1", "11.3"), new EventPoints(3.0m, 0.0m, "Athlete2", "TM1", "11.4"), new EventPoints(0.0m, 0.0m, "Athlete3", "TM2", "11.5"), 8.0m, 0.0m); if (!control.validate()) { test = false; Console.WriteLine("control was invalid"); } if (team1PtsDontMatch.validate()) { test = false; Console.WriteLine("team1PtsDontMatch was valid"); } if (team2PtsDontMatch.validate()) { test = false; Console.WriteLine("team2PtsDontMatch was valid"); } if (totalAbove9.validate()) { test = false; Console.WriteLine("totalAbove9 was valid"); } if (noNameTeam1.validate()) { test = false; Console.WriteLine("noNameTeam1 was valid"); } if (noNameTeam2.validate()) { test = false; Console.WriteLine("noNameTeam2 was valid"); } if (nullNameTeam1.validate()) { test = false; Console.WriteLine("nullNameTeam1 was valid"); } if (nullNameTeam2.validate()) { test = false; Console.WriteLine("nullNameTeam2 was valid"); } if (nullNameTeam3.validate()) { test = false; Console.WriteLine("nullNameTeam3 was valid"); } if (noNameWithPtsTeam1.validate()) { test = false; Console.WriteLine("noNameWithPtsTeam1 was valid"); } if (noNameWithPtsTeam2.validate()) { test = false; Console.WriteLine("noNameWithPtsTeam2 was valid"); } if (noNameWithPtsTeam3.validate()) { test = false; Console.WriteLine("noNameWithPtsTeam3 was valid"); } if (nameWithNoPtsTeam1.validate()) { test = false; Console.WriteLine("nameWithNoPtsTeam1 was valid"); } if (nameWithNoPtsTeam2.validate()) { test = false; Console.WriteLine("nameWithNoPtsTeam2 was valid"); } if (nameWithNoPtsTeam3.validate()) { test = false; Console.WriteLine("nameWithNoPtsTeam3 was valid"); } Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed"); Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed"); }