public void CreateCarnivores_WillFailIfPositionAlreadyTaken() { var given = new List <Event> { new CreateBoardAccepted(20, 20, new List <Herbivore>(), new List <Carnivore>(), Message.CausationId, Message.CorrelationId, Message.CreatedOn), new CreateCarnivoreAccepted("testivore", 2, 3, 20, Message) }; var when = new CreateCarnivore("testivore", 2, 3, 20, "woop2"); Execute(given, when, typeof(Surface.PositionAlreadyTakenException), events => new Surface(events, new Random())); }
public void CreateCarnivores_HaveRightLocation() { var given = new List <Event> { new CreateBoardAccepted(20, 20, new List <Herbivore>(), new List <Carnivore>(), Message.CausationId, Message.CorrelationId, Message.CreatedOn) }; var when = new CreateCarnivore("testivore", 2, 3, 20, "woop2"); var then = new List <Event> { new CreateCarnivoreAccepted("testivore", 2, 3, 20, Message) }; var results = Execute(given, when, then, events => new Surface(events, new Random())); var carnivores = results.Select(r => (CreateCarnivoreAccepted)r).ToList(); foreach (var carnivore in carnivores) { Assert.Single(carnivores, c => c.X == carnivore.X && c.Y == carnivore.Y); } }