public void can_archive_valid_Normalschein()
 {
     var schein = new Normalschein(new Normalfeld(1,2,3,4,5,6));
     Assert.That(schein.IsValid());
     Lotto.CurrentSpiel.Vorlage = schein;
     sut.archive();
     Assert.That(Lotto.CurrentSpiel.Scheine.Count, Is.EqualTo(1));
 }
Exemple #2
0
        public void can_quick()
        {
            ISchein sut = new Normalschein();
            sut.quick();
            Assert.IsFalse(sut.Tippfelder.Any(x => x.IsEmpty()));

            sut = new Systemschein();
            sut.quick();
            sut.Tippfelder.Each(Console.WriteLine);
            Assert.IsFalse(sut.Tippfelder.Any(x => x.IsEmpty()));
        }
 public void can_save()
 {
     ISchein schein = new Normalschein( new Normalfeld( 1, 2, 3, 4, 5, 6));
     IAuftrag auftrag = new Auftrag(schein);
     ATipp tipp = new Tipp(schein.Tippfelder[0].Tippzahlen.ToArray());
     sut = new IndexedTipp(auftrag, tipp, schein.Tippfelder[0].Index);
     s1.Save(auftrag);
     s1.Save(tipp);
     s1.Save(sut);
     s1.Flush();
 }
 public void ctor()
 {
     ISchein schein = new Normalschein( new Normalfeld( 1, 2, 3, 4, 5, 6));
     IAuftrag auftrag = new Auftrag(schein);
     ATipp tipp = new Tipp(schein.Tippfelder[0].Tippzahlen.ToArray());
     sut = new IndexedTipp(auftrag, tipp, schein.Tippfelder[0].Index);
     Assert.That(sut.Idx, Is.EqualTo(schein.Tippfelder[0].Index));
     Assert.That(sut.Tipp.SID, Is.EqualTo(schein.Tippfelder[0].SID));
     Assert.That(
         Stringifier.stringify(sut.Tipp.Tippzahlen), Is.EqualTo(
         Stringifier.stringify(schein.Tippfelder[0].Tippzahlen)));
 }
        public void can_delete()
        {
            Lotto.CurrentSpiel.Vorlage = new Normalschein();
            sut.delete();
            Assert.That(Lotto.CurrentSpiel.Vorlage.Tippfelder.All(x => x.IsEmpty()));

            var foo = new Normalschein() {Losnummer = "foo"};
            var bar = new Normalschein() { Losnummer = "bar" };
            Lotto.CurrentSpiel = new Spiel(foo, bar) { Vorlage = foo };
            Assert.That(Lotto.CurrentSpiel.Scheine.Count, Is.EqualTo(2));
            Assert.That(Lotto.CurrentSpiel.Vorlage, Is.EqualTo(foo));
            sut.delete();
            Assert.That(Lotto.CurrentSpiel.Vorlage.Tippfelder.All(x => x.IsEmpty()));
            Assert.That(Lotto.CurrentSpiel.Scheine.Count, Is.EqualTo(1));
            Assert.That(Lotto.CurrentSpiel.Vorlage, Is.EqualTo(bar));
        }
Exemple #6
0
        public void can_validate_ISchein_in_Auftrag_context()
        {
            var schein = new Normalschein(new Normalfeld().quick() as Normalfeld, new Normalfeld());
            sut = new Auftrag(schein);
            X.printValidationErros(sut);
            Assert.That(X.isValid(sut));

            sut = new Auftrag(new Normalschein().quick());
            Assert.That(X.isValid(sut));

            sut = new Auftrag(new Systemschein().quick());
            Assert.That(X.isValid(sut));
        }
        public void wont_archive_invalid_schein()
        {
            var schein = new Normalschein(new Normalfeld());
            Assert.That(!schein.IsValid());
            Lotto.CurrentSpiel.Vorlage = schein;
            sut.archive();
            Assert.That(Lotto.CurrentSpiel.Scheine.Count, Is.EqualTo(0));

            schein = new Normalschein();
            Assert.That(!schein.IsValid());
            Lotto.CurrentSpiel.Vorlage = schein;
            sut.archive();
            Assert.That(Lotto.CurrentSpiel.Scheine.Count, Is.EqualTo(0));
        }
        public void wont_archive_empty_Schein()
        {
            ISchein schein = new Normalschein();
            Assert.That(!schein.IsValid());
            Lotto.CurrentSpiel.Vorlage = schein;
            sut.archive();
            Assert.That(Lotto.CurrentSpiel.Scheine.Count, Is.EqualTo(0));

            schein = new Systemschein();
            Assert.That(!schein.IsValid());
            Lotto.CurrentSpiel.Vorlage = schein;
            sut.archive();
            Assert.That(Lotto.CurrentSpiel.Scheine.Count, Is.EqualTo(0));
        }