コード例 #1
0
ファイル: MoveTests.cs プロジェクト: transformania/tt-game
        public void should_throw_exception_if_player_is_not_feral_animal()
        {
            var petPlayer = new PlayerBuilder()
                            .With(p => p.Id, 51)
                            .With(p => p.Mobility, PvPStatics.MobilityPet)
                            .BuildAndSave();

            var item = new ItemBuilder()
                       .With(p => p.FormerPlayer, petPlayer)
                       .With(p => p.Owner, new PlayerBuilder()
                             .With(p => p.FirstName, "Bob")
                             .With(p => p.LastName, "Smith")
                             .BuildAndSave())
                       .BuildAndSave();

            petPlayer.SetItem(item);
            item.SetFormerPlayer(petPlayer);

            var cmd = new Move {
                PlayerId = 51, destination = destination
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("You can't move because you are a non-feral pet owned by Bob Smith."));
        }