Beispiel #1
0
        public Player(
            string firstName,
            string lastName,
            int age,
            string nationality,
            string photoUrl,
            BattingStyle battingStyle,
            BowlingStyle bowlingStyle,
            FieldingPosition fieldingPosition,
            History history)
        {
            this.Validate(firstName, lastName, age, nationality, photoUrl);
            this.ValidateBowlingStyle(bowlingStyle);
            this.ValidateFieldingPosition(fieldingPosition);

            this.FirstName        = firstName;
            this.LastName         = lastName;
            this.Age              = age;
            this.Nationality      = nationality;
            this.PhotoUrl         = photoUrl;
            this.BattingStyle     = battingStyle;
            this.BowlingStyle     = bowlingStyle;
            this.FieldingPosition = fieldingPosition;
            this.History          = history;
        }
Beispiel #2
0
        public void UpdateFieldingPositionShouldSetBowlingStyle()
        {
            //Arrange
            var fieldingPosition = A.Dummy <FieldingPosition>();

            //Act
            this._player !.UpdateFieldingPosition(fieldingPosition);

            //Assert
            this._player !.FieldingPosition
            .Should()
            .BeEquivalentTo(fieldingPosition);
        }
Beispiel #3
0
        public void InvalidFieldingPositionNameShouldThrowException()
        {
            //Arrange
            var fieldingPosition = new FieldingPosition(
                "Invalid position",
                "Some invalid fieliding position");

            //Act
            Action act = ()
                         => this._player !.UpdateFieldingPosition(fieldingPosition);

            //Assert
            act.Should().Throw <InvalidPlayerException>();
        }