public IProtocol evaluateSpiel77(IAusspielung ausspielung) { if (IsSpiel77) for (int i = 0; i < 7; i++) if (Spiel77.Substring(i).Equals(ausspielung.Spiel77.Substring(i))) return new Spiel77Protocol(new Dictionary<int, int> { { i + 1, 1 } }); return new Spiel77Protocol(new Dictionary<int, int>(0)); }
public IProtocol evaluateSuper6(IAusspielung ausspielung) { if (IsSuper6) for (int i = 0; i < 6; i++) if (Super6.Substring(i).Equals(ausspielung.Super6.Substring(i))) return new Super6Protocol(new Dictionary<int, int> { { i + 1, 1 } }); return new Super6Protocol(new Dictionary<int, int>(0)); }
public static IEnumerable<IProtocol> evaluate(this ISitzung o, IAusspielung ausspielung) { IList<IProtocol> temp = new List<IProtocol>(3); if (o.IsWinLotto(ausspielung)) temp.Add(merge(o.Auftraege.Select(x => x.evaluateLotto(ausspielung)))); if (o.IsWinSpiel77(ausspielung)) temp.Add(merge(o.Auftraege.Select(x => x.Zusatzchance.evaluateSpiel77(ausspielung)))); if (o.IsWinSuper6(ausspielung)) temp.Add(merge(o.Auftraege.Select(x => x.Zusatzchance.evaluateSuper6(ausspielung)))); return temp; }
public void can_validate() { sut = new Ausspielung(); Assert.That(X.isValid(sut)); sut = new Ausspielung(new[] { 1, 2, 3, 4, 5, 6 }, 49, "1234567", "123456", 0); Assert.That(sut.Zusatzzahl, Is.EqualTo(49)); Assert.That(sut.Superzahl, Is.EqualTo(0)); Assert.That(X.isValid(sut)); }
public static IEnumerable<IProtocol> evaluate(this IAuftrag o, IAusspielung ausspielung) { IList<IProtocol> temp = new List<IProtocol>(3); if (o.IsWinLotto(ausspielung)) temp.Add(o.evaluateLotto(ausspielung)); if (o.IsWinSpiel77(ausspielung)) temp.Add(o.Zusatzchance.evaluateSpiel77(ausspielung)); if (o.IsWinSuper6(ausspielung)) temp.Add(o.Zusatzchance.evaluateSuper6(ausspielung)); return temp; }
public override IProtocol evaluate(IAuftrag auftrag, IAusspielung ausspielung) { bool zusatzzahl = Tippzahlen.Contains(ausspielung.Zusatzzahl); switch (ausspielung.Gewinnzahlen.Intersect(Tippzahlen).Count()) { case 6: if (ausspielung.Superzahl == auftrag.Superzahl) return zusatzzahl ? Protocols._013_6_ZZ_SZ : Protocols._013_6_SZ; return zusatzzahl ? Protocols._013_6_ZZ : Protocols._013_6; case 5: return zusatzzahl ? Protocols._013_5_ZZ : Protocols._013_5; case 4: return zusatzzahl ? Protocols._013_4_ZZ : Protocols._013_4; case 3: return zusatzzahl ? Protocols._013_3_ZZ : Protocols._013_3; } return new LottoProtocol(new Dictionary<int, int>(0)); }
public override IProtocol evaluate(IAuftrag auftrag, IAusspielung ausspielung) { int i; switch (ausspielung.Gewinnzahlen.Intersect(Tippzahlen).Count()) { case 6: i = ausspielung.Superzahl == auftrag.Superzahl ? 1 : 2; break; case 5: i = Tippzahlen.Contains(ausspielung.Zusatzzahl) ? 3 : 4; break; case 4: i = Tippzahlen.Contains(ausspielung.Zusatzzahl) ? 5 : 6; break; case 3: i = Tippzahlen.Contains(ausspielung.Zusatzzahl) ? 7 : 8; break; default: return new LottoProtocol(new Dictionary<int, int>(0)); } return new LottoProtocol(new Dictionary<int, int> { { i, 1 } }); }
public static bool IsWin(this IAuftrag o, IAusspielung ausspielung) { return o.Zusatzchance.IsWin(ausspielung) || o.IsWinLotto(ausspielung); }
public static bool IsWin(this ISitzung o, IAusspielung ausspielung) { return o.Auftraege.Any(x => x.Zusatzchance.IsWin(ausspielung)) || o.Auftraege.Any(x => x.IsWinLotto(ausspielung)); }
public static IProtocol evaluateLotto(this IAuftrag o, IAusspielung ausspielung) { return merge(o.Tipps.Select(x => x.evaluate(ausspielung))); }
public static IProtocol evaluateLotto(this ISitzung o, IAusspielung ausspielung) { return merge(o.Auftraege.Select(x => x.evaluateLotto(ausspielung))); }
public void gt_not_unique() { sut = new Ausspielung(new[] { 1, 1, 3, 4, 5, 6 }, 7, "1234567", "123456", 0); X.isValid(sut); }
public abstract IProtocol evaluate(IAuftrag auftrag, IAusspielung ausspielung);
public EvaluationResult(ISitzung sitzung, IAusspielung ausspielung) { Guard.ifNull<IAusspielung>(ausspielung); this.Protocols = sitzung.evaluate(ausspielung); this.ausspielung = ausspielung; }
public static bool IsWinSuper6(this Zusatzchance o, IAusspielung ausspielung) { return o.IsSuper6 && o.Super6.Substring(5).Equals(ausspielung.Super6.Substring(5)); }
public static bool IsWinSuper6(this IAuftrag o, IAusspielung ausspielung) { return o.Zusatzchance.IsWinSuper6(ausspielung); }
public static bool IsWinSuper6(this ISitzung o, IAusspielung ausspielung) { return o.Auftraege.Any(x => x.IsWinSuper6(ausspielung)); }
public static bool IsWinSpiel77(this Zusatzchance o, IAusspielung ausspielung) { return o.IsSpiel77 && o.Spiel77.Substring(6).Equals(ausspielung.Spiel77.Substring(6)); }
public static bool IsWinLotto(this IAuftrag o, IAusspielung ausspielung) { return o.Tipps.Any(x => 2 < ausspielung.Gewinnzahlen.Intersect(x.Tipp.Tippzahlen).Count()); }
public static bool IsWin(this ITippfeld o, IAusspielung ausspielung) { return !o.IsEmpty() && 2 < o.Tippzahlen.Intersect(ausspielung.Gewinnzahlen).Count(); }
public static bool IsWin(this Zusatzchance o, IAusspielung ausspielung) { return o.IsWinSuper6(ausspielung) || o.IsWinSpiel77(ausspielung); }
public EvaluationService(IAusspielung ausspielung) { Guard.ifNull<IAusspielung>(ausspielung); this.ausspielung = ausspielung; }
public override IProtocol evaluate(IAuftrag auftrag, IAusspielung ausspielung) { throw new NotImplementedException(); }
public void gt_lt_6() { sut = new Ausspielung(new[] { 1, 2, 3, 4, 5 }, 7, "1234567", "123456", 0); X.isValid(sut); }
public void sup() { sut = new Gewinnauswertung(null, null, null, new IntersectionService()); spielauftrag = MockRepository.GenerateStub<ISpielauftrag>(); ausspielung = MockRepository.GenerateStub<IAusspielung>(); tipp = MockRepository.GenerateStub<ITipp>(); spielauftrag.Stub(x => x.Tipps).Return(new[] { tipp }); tipp.Stub(x => x.Tippzahlen).Return(new[] { 1, 2, 3, 4, 5, 6 }); spielauftrag.Stub(x => x.Losnummer).Return("1234567"); }
public void sz_gt_9() { sut = new Ausspielung(new[] { 1, 2, 3, 4, 5, 6 }, 7, "1234567", "123456", 10); X.isValid(sut); }
public void sup() { ausspielung = new Ausspielung(new[] { 1, 2, 3, 4, 5, 6 }, 49, "1234567", "123456", 0); }
public void s6_lt_6() { // super6 lt 6 sut = new Ausspielung(new[] { 1, 2, 3, 4, 5, 6 }, 7, "1234567", "12345", 0); X.isValid(sut); }
public static IProtocol evaluate(this IIndexedTipp o, IAusspielung ausspielung) { return o.Tipp.evaluate(o.Auftrag, ausspielung); }
public void s77_lt_7() { sut = new Ausspielung(new[] { 1, 2, 3, 4, 5, 6 }, 7, "123456", "123456", 0); X.isValid(sut); }