public void GesamtschlagzahlMitLochwechsel() { _scorecard.ErhoeheAnzahlSchlaege(); _scorecard.SchliesseLochAb(); _scorecard.ErhoeheAnzahlSchlaege(); Assert.That(_scorecard.GesamtAnzahlSchlaege, Is.EqualTo(2)); }
public void ScoreCard_ZeilenAusgabe() { _scorecard.ErhoeheAnzahlSchlaege(); _scorecard.SchliesseLochAb(); string resultText = new ScorecardOperation().FuehreAus(_scorecard); var lines = resultText.Split(new[] { Environment.NewLine }, StringSplitOptions.None); var secondLine = lines[1]; secondLine = secondLine.Replace(" ", string.Empty); Assert.That(secondLine.StartsWith("1") && secondLine.EndsWith("1"), "Loch und Anzahl ist wrong"); var thirdLine = lines[2]; thirdLine = thirdLine.Replace(" ", string.Empty); Assert.That(thirdLine.StartsWith("2") && thirdLine.EndsWith("0"), "Loch und Anzahl ist wrong"); }
public string FuehreAus(IScorecard scorecard) { int schlagZahl = scorecard.AnzahlSchlaege; int parZahl = scorecard.ParZahl; string schlagWort = (schlagZahl == 1) ? "Schlag" : "Schlaege"; if (schlagZahl > parZahl) { Console.WriteLine(string.Format("Du hattest {0} {1} ({2} ueber Par).", schlagZahl, schlagWort, schlagZahl - parZahl)); } else if (schlagZahl < parZahl) { Console.WriteLine(string.Format("Du hattest {0} {1} ({2} unter Par).", schlagZahl, schlagWort, parZahl - schlagZahl)); } else { Console.WriteLine(string.Format("Du hattest {0} {1} genau Par.", schlagZahl, schlagWort)); } scorecard.SchliesseLochAb(); return(new Lochbegruessung().FuehreAus(scorecard)); }
public void ErhoehtLochnummerBeiLochwechsel() { _scorecard.SchliesseLochAb(); Assert.That(_scorecard.Lochnummer, Is.EqualTo(2)); }
public string FuehreAus(IScorecard scorecard, ITracker tracker) { scorecard.SchliesseLochAb(); return(""); }
public string FuehreAus(IScorecard scorecard) { scorecard.SchliesseLochAb(); return(new Lochbegruessung().FuehreAus(scorecard)); }