public void CanMoveAsPlayer_NoSneak() { 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.ActionPoints, 10) .With(i => i.Location, LocationsStatics.STREET_200_SUNNYGLADE_DRIVE) .With(i => i.LastActionTimestamp, DateTime.UtcNow.AddHours(-2)) .With(i => i.MoveActionPointDiscount, .5M) .With(p => p.User, new UserBuilder() .With(u => u.Stats, stats) .With(u => u.Id, "bob") .BuildAndSave()) .BuildAndSave(); var item1 = new ItemBuilder() .With(i => i.Id, 1) .With(i => i.Owner.Id, 50) .With(i => i.IsEquipped, true) .With(i => i.dbLocationName, player.Location) .BuildAndSave(); var item2 = new ItemBuilder() .With(i => i.Id, 2) .With(i => i.Owner.Id, 50) .With(i => i.IsEquipped, false) .With(i => i.dbLocationName, player.Location) .BuildAndSave(); player.Items.Add(item1); player.Items.Add(item2); var destinationLogs = player.MoveTo("coffee_shop_patio"); Assert.That(destinationLogs.SourceLocationLog, Is.EqualTo("John Doe left toward Carolyne's Coffee Shop (Patio)")); Assert.That(destinationLogs.DestinationLocationLog, Is.EqualTo("John Doe 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.ActionPoints, Is.EqualTo(9.5M)); Assert.That(player.User.Stats.First(s => s.AchievementType == StatsProcedures.Stat__TimesMoved).Amount, Is.EqualTo(4)); Assert.That(player.Items.ElementAt(0).dbLocationName, Is.Empty); Assert.That(player.Items.ElementAt(1).dbLocationName, Is.Empty); Assert.That(player.LastActionTimestamp, Is.EqualTo(DateTime.UtcNow).Within(10).Seconds); }
public void CanMoveAsPlayer_WithSneak() { var stats = new List <Stat> { new StatBuilder().With(t => t.AchievementType, StatsProcedures.Stat__TimesMoved).With(t => t.Amount, 8).BuildAndSave() }; var player = new PlayerBuilder() .With(i => i.ActionPoints, 10) .With(i => i.Location, LocationsStatics.STREET_200_SUNNYGLADE_DRIVE) .With(i => i.SneakPercent, 100) .With(p => p.User, new UserBuilder() .With(u => u.Stats, stats) .With(u => u.Id, "bob") .BuildAndSave()) .BuildAndSave(); var logs = player.MoveTo("coffee_shop_patio"); Assert.That(logs.SourceLocationLog, Is.EqualTo("John Doe left toward Carolyne's Coffee Shop (Patio)")); Assert.That(logs.DestinationLocationLog, Is.EqualTo("John Doe entered from Street: 200 Sunnyglade Drive")); Assert.That(logs.ConcealmentLevel, Is.GreaterThan(0)); Assert.That(player.PlayerLogs.ElementAt(0).Message, Does.StartWith( "You moved from <b>Street: 200 Sunnyglade Drive</b> to <b>Carolyne's Coffee Shop (Patio)</b>. (Concealment lvl <b>")); Assert.That(player.PlayerLogs.ElementAt(0).IsImportant, Is.False); Assert.That(player.Location, Is.EqualTo("coffee_shop_patio")); Assert.That(player.ActionPoints, Is.EqualTo(9)); Assert.That(player.User.Stats.First(s => s.AchievementType == StatsProcedures.Stat__TimesMoved).Amount, Is.EqualTo(9)); Assert.That(player.LastActionTimestamp, Is.EqualTo(DateTime.UtcNow).Within(10).Seconds); }