示例#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;
        }
示例#2
0
        public void UpdateBowlingStyleShouldSetBowlingStyle()
        {
            //Arrange
            var bowlingStyle = A.Dummy <BowlingStyle>();

            //Act
            this._player !.UpdateBowlingStyle(bowlingStyle);

            //Assert
            this._player !.BowlingStyle
            .Should()
            .BeEquivalentTo(bowlingStyle);
        }
示例#3
0
        public void InvalidBowlingStyleNameShouldThrowException()
        {
            //Arrange
            var bowlingStyle = new BowlingStyle(
                "Invalid bowling",
                BowlingTypes.FastBowling,
                "Some invalid bowling style");

            //Act
            Action act = ()
                         => this._player !.UpdateBowlingStyle(bowlingStyle);

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