public void should_throw_exception_if_item_id_not_specified() { var cmd = new ThrowTGBomb { PlayerId = 12 }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo("ItemId is required.")); }
public void should_throw_exception_if_player_not_found() { var bomb = new ItemBuilder() .With(i => i.ItemSource, new ItemSourceBuilder().BuildAndSave()) .With(i => i.Id, 5) .BuildAndSave(); var cmd = new ThrowTGBomb { ItemId = bomb.Id, PlayerId = 12 }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo("player with ID 12 could not be found.")); }
public void should_throw_exception_if_item_not_found() { var thrower = new PlayerBuilder() .With(p => p.Id, 5) .With(p => p.Location, TavernLocation) .With(p => p.Items, new List <Item>()) .BuildAndSave(); var cmd = new ThrowTGBomb { ItemId = 2365, PlayerId = thrower.Id }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message .EqualTo("Item with ID 2365 could not be found or does not belong to you.")); }