コード例 #1
0
ファイル: _Sitzung.cs プロジェクト: bjornebjornson/LottoNh2
        public void can_convert()
        {
            sut = new Sitzung(new Spiel(
                new Normalschein(new Normalfeld(), new Normalfeld(1, 2, 3, 4, 5, 6)) {Losnummer = "0000001"},
                new Normalschein(),
                new Normalschein(new Normalfeld(1, 2, 3, 4, 5, 6)) { Losnummer = "0000002" }));
            var spiel = sut.toSpiel();
            Assert.That(spiel.Scheine.Where(x => !x.IsEmpty()).Count(), Is.EqualTo(2));
            Assert.That(spiel.Scheine[0].Losnummer, Is.EqualTo("0000001"));
            Assert.That(spiel.Scheine[1].Losnummer, Is.EqualTo("0000002"));
            Assert.That(spiel.Scheine[0].Tippfelder[1].Tippzahlen.Count, Is.EqualTo(6));
            Assert.That(spiel.Scheine[1].Tippfelder[0].Tippzahlen.Count, Is.EqualTo(6));
            Assert.That(spiel.Vorlage, Is.EqualTo(spiel.Scheine[0]));

            sut = new Sitzung(new Spiel(
                new Systemschein(new Systemfeld(), new Systemfeld(1, 2, 3, 4, 5, 6, 7){SID = 7}) { Losnummer = "0000001" },
                new Normalschein(),
                new Normalschein(new Normalfeld(1, 2, 3, 4, 5, 6)) { Losnummer = "0000002" },
                new Systemschein(new Systemfeld(1, 2, 3, 4, 5, 6, 7, 8){SID = 8}) { Losnummer = "0000003" }
                ));
            spiel = sut.toSpiel();
            Assert.That(spiel.Scheine.Where(x => !x.IsEmpty()).Count(), Is.EqualTo(3));
            Assert.That(spiel.Scheine[0] is Systemschein);
            Assert.That(spiel.Scheine[0].Losnummer, Is.EqualTo("0000001"));
            Assert.That(spiel.Scheine[0].Tippfelder[0] is Systemfeld);
            Assert.That(spiel.Scheine[0].Tippfelder[0].IsEmpty());
            Assert.That(spiel.Scheine[0].Tippfelder[1].Tippzahlen.Count, Is.EqualTo(7));
            Assert.That(spiel.Scheine[1] is Normalschein);
            Assert.That(spiel.Scheine[1].Losnummer, Is.EqualTo("0000002"));
            Assert.That(spiel.Scheine[1].Tippfelder[0].Tippzahlen.Count, Is.EqualTo(6));
            Assert.That(spiel.Scheine[2] is Systemschein);
            Assert.That(spiel.Scheine[2].Losnummer, Is.EqualTo("0000003"));
            Assert.That(spiel.Scheine[2].Tippfelder[0].Tippzahlen.Count, Is.EqualTo(8));
            Assert.That(spiel.Vorlage, Is.EqualTo(spiel.Scheine[0]));
        }
コード例 #2
0
ファイル: _Sitzung.cs プロジェクト: bjornebjornson/LottoNh2
        public void can_validate()
        {
            sut = new Sitzung(new Spiel(new Normalschein().quick()));
            Assert.That(sut.IsValid());

            sut = new Sitzung(new Spiel(new Systemschein().quick()));
            Assert.That(sut.IsValid());

            sut = new Sitzung(new Spiel(new Normalschein().quick(), new Systemschein().quick()));
            Assert.That(sut.IsValid());

            sut = new Sitzung(new Spiel(new Systemschein(new Systemfeld(ZahlRandomiser.many(7)) { SID = 7 })));
            Assert.IsTrue(sut.IsValid());

            sut = new Sitzung(new Spiel(new Normalschein().quick(), new Normalschein(new Normalfeld(1))));
            Assert.That(sut.IsValid(), Is.False);

            sut = new Sitzung(new Spiel(new Systemschein(new Systemfeld(ZahlRandomiser.many(7)) { SID = 8 })));
            Assert.That(sut.IsValid(), Is.False);
        }
コード例 #3
0
ファイル: _Sitzung.cs プロジェクト: bjornebjornson/LottoNh2
        public void can_validate_()
        {
            sut = new Sitzung(new Spiel(new Normalschein()));
            Assert.That(sut.IsValid(), Is.False);

            sut = new Sitzung(new Spiel(new Systemschein()));
            Assert.That(sut.IsValid(), Is.False);
        }
コード例 #4
0
 public EvaluationResult(ISitzung sitzung, IAusspielung ausspielung)
 {
     Guard.ifNull<IAusspielung>(ausspielung);
     this.Protocols = sitzung.evaluate(ausspielung);
     this.ausspielung = ausspielung;
 }