Exemple #1
0
        public void FoulAction_CanSpawn_YellowCardEvent()
        {
            //Arrange
            var randomnessProvider = new TestRandomnessProvider(3);
            var foul = new Foul(randomnessProvider);
            var card = new Card {
                Id = Guid.NewGuid()
            };

            //Act
            var @event = foul.SpawnEvent(card, new Guid(), 0, new ApplicationCore.Models.Match());

            //Assert
            Assert.Equal(typeof(YellowCard), @event.GetType());
        }
Exemple #2
0
        public void FoulAction_WithInvalidRandomNumber_ShouldSpawnNullEvent()
        {
            //Arrange
            var randomnessProvider = new TestRandomnessProvider(-1);
            var foul = new Foul(randomnessProvider);
            var card = new Card {
                Id = Guid.NewGuid()
            };

            //Act
            var @event = foul.SpawnEvent(card, new Guid(), 0, new ApplicationCore.Models.Match());

            //Assert
            Assert.Null(@event);
        }
Exemple #3
0
        public void FoulAction_OnAYellowCard_WithASecondYellow_ShouldSpawnARedCardEvent()
        {
            //Arrange
            var randomnessProvider = new TestRandomnessProvider(3);
            var foul   = new Foul(randomnessProvider);
            var cardId = Guid.NewGuid();
            var card   = new Card {
                Id = cardId
            };
            var match = new ApplicationCore.Models.Match();

            match.Events.Add(new YellowCard(5, cardId, new Guid()));

            //Act
            var @event = foul.SpawnEvent(card, new Guid(), 10, match);

            //Assert
            Assert.Equal(typeof(RedCard), @event.GetType());
        }