示例#1
0
        public void CanMoveAsAnimal()
        {
            var stats = new List <Stat>
            {
                new StatBuilder().With(t => t.AchievementType, StatsProcedures.Stat__TimesMoved).With(t => t.Amount, 3).BuildAndSave()
            };

            var player = new PlayerBuilder()
                         .With(i => i.Location, LocationsStatics.STREET_200_SUNNYGLADE_DRIVE)
                         .With(p => p.User, new UserBuilder()
                               .With(u => u.Stats, stats)
                               .BuildAndSave())
                         .With(p => p.Item, new ItemBuilder()
                               .With(i => i.dbLocationName, "someplace")
                               .BuildAndSave()
                               )
                         .BuildAndSave();

            var destinationLogs = player.MoveToAsAnimal("coffee_shop_patio");

            Assert.That(destinationLogs.SourceLocationLog,
                        Is.EqualTo("John Doe (feral) left toward Carolyne's Coffee Shop (Patio)"));
            Assert.That(destinationLogs.DestinationLocationLog,
                        Is.EqualTo("John Doe (feral) entered from Street: 200 Sunnyglade Drive"));

            Assert.That(player.PlayerLogs.ElementAt(0).Message,
                        Is.EqualTo(
                            "You moved from <b>Street: 200 Sunnyglade Drive</b> to <b>Carolyne's Coffee Shop (Patio)</b>."));
            Assert.That(player.PlayerLogs.ElementAt(0).IsImportant, Is.False);

            Assert.That(player.Location, Is.EqualTo("coffee_shop_patio"));

            Assert.That(player.User.Stats.First(s => s.AchievementType == StatsProcedures.Stat__TimesMoved).Amount,
                        Is.EqualTo(4));
        }