コード例 #1
0
        public void ScoreCard_Formatierung()
        {
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();

            string resultText = new ScorecardOperation().FuehreAus(_scorecard);
            var    lines      = resultText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            var    secondLine = lines[1];

            Assert.AreEqual("    1 |        2", secondLine);

            _scorecard.SchliesseLochAb();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();
            _scorecard.ErhoeheAnzahlSchlaege();

            resultText = new ScorecardOperation().FuehreAus(_scorecard);
            lines      = resultText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            string thirdLine = lines[2];

            Assert.AreEqual("    2 |       11", thirdLine);
        }
コード例 #2
0
        public void ScoreCard_HeaderAnzeigen()
        {
            string resultText = new ScorecardOperation().FuehreAus(null);
            var    lines      = resultText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            var    firstLine  = lines.First();

            Assert.That(firstLine, Contains.Substring("Loch"));
            Assert.That(firstLine, Contains.Substring("Schlaege"));
        }
コード例 #3
0
        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");
        }