Esempio n. 1
0
        public void ComboMatchesEvents_Larger()
        {
            // Ensure yellow, yellow, blue, yellow matches blue alone

            var events = new MatchEvent[]
            {
                new MatchEvent {
                    Id = 11, IdMatch = 1001, Type = (int)MatchEventType.Card1, IdPlayer = 101, MatchMinute = 8
                },
                new MatchEvent {
                    Id = 12, IdMatch = 1001, Type = (int)MatchEventType.Card1, IdPlayer = 101, MatchMinute = 20
                },
                new MatchEvent {
                    Id = 11, IdMatch = 1001, Type = (int)MatchEventType.Card3, IdPlayer = 101, MatchMinute = 8
                },
                new MatchEvent {
                    Id = 12, IdMatch = 1001, Type = (int)MatchEventType.Card1, IdPlayer = 101, MatchMinute = 20
                },
            };

            // Blue alone generates red card
            var combo = new AutoSanctionCardConfig {
                Card1Type = 3, Card2Type = 0, Penalty = new PenaltyConfig {
                    Type1 = 2
                }
            };

            var result = AutoSanctionDispatcher.ComboAppliesToMatchEvents(combo, events, out MatchEvent ev1, out MatchEvent ev2);

            Assert.IsTrue(result);
        }
Esempio n. 2
0
        public void ComboMatchesEvents_Negative1()
        {
            // Ensure blue + yellow doesn't match yellow + yellow

            var events = new MatchEvent[]
            {
                new MatchEvent {
                    Id = 11, IdMatch = 1001, Type = (int)MatchEventType.Card3, IdPlayer = 101, MatchMinute = 8
                },
                new MatchEvent {
                    Id = 12, IdMatch = 1001, Type = (int)MatchEventType.Card1, IdPlayer = 101, MatchMinute = 20
                },
            };

            // Yellow + Yellow generate red card
            var combo = new AutoSanctionCardConfig {
                Card1Type = 1, Card2Type = 1, Penalty = new PenaltyConfig {
                    Type1 = 2
                }
            };

            var result = AutoSanctionDispatcher.ComboAppliesToMatchEvents(combo, events, out MatchEvent ev1, out MatchEvent ev2);

            Assert.IsFalse(result);
        }
Esempio n. 3
0
        public void ComboMatchesEvents_InverseMatch()
        {
            // Ensure blue + yellow matches yellow + blue combo

            var events = new MatchEvent[]
            {
                // Blue + yellow
                new MatchEvent {
                    Id = 11, IdMatch = 1001, Type = (int)MatchEventType.Card3, IdPlayer = 101, MatchMinute = 8
                },
                new MatchEvent {
                    Id = 12, IdMatch = 1001, Type = (int)MatchEventType.Card1, IdPlayer = 101, MatchMinute = 20
                },
            };

            // Yellow + Blue generate red card
            var combo = new AutoSanctionCardConfig {
                Card1Type = 1, Card2Type = 3, Penalty = new PenaltyConfig {
                    Type1 = 2
                }
            };

            var result = AutoSanctionDispatcher.ComboAppliesToMatchEvents(combo, events, out MatchEvent ev1, out MatchEvent ev2);

            Assert.IsTrue(result);
        }
Esempio n. 4
0
        public void ComboMatchesEvents_EqualCards()
        {
            // Ensure two yellow cards are matched

            var events = new MatchEvent[]
            {
                // Two yellow cards
                new MatchEvent {
                    Id = 11, IdMatch = 1001, Type = (int)MatchEventType.Card1, IdPlayer = 101, MatchMinute = 8
                },
                new MatchEvent {
                    Id = 12, IdMatch = 1001, Type = (int)MatchEventType.Card1, IdPlayer = 101, MatchMinute = 20
                },
            };

            // Two yellow cards generate a red card
            var combo = new AutoSanctionCardConfig {
                Card1Type = 1, Card2Type = 1, Penalty = new PenaltyConfig {
                    Type1 = 2
                }
            };

            var result = AutoSanctionDispatcher.ComboAppliesToMatchEvents(combo, events, out MatchEvent ev1, out MatchEvent ev2);

            Assert.IsTrue(result);
        }