public void PotionSelect() { PotionRepository repo = new PotionRepository(new PotionSQLContext()); Potion c = repo.GetById(1); Assert.IsNotNull(c, "Potion wasn't correctly retrieved"); }
public void PotionsSelect() { PotionRepository repo = new PotionRepository(new PotionSQLContext()); List <Potion> c = repo.GetAll(); Assert.IsNotNull(c, "Potions weren't correctly retrieved"); }
// TODO: Add Character and Armor Controllers public static void ConfigureControllers(DataContext context, Mapper mapper, out PotionController potionController, out WeaponController weaponController, out ArmorController armorController, out CharacterController characterController) { PotionRepository potionRepository = new PotionRepository(context); WeaponRepository weaponRepository = new WeaponRepository(context); ArmorRepository armorRepository = new ArmorRepository(context); CharacterRepository characterRepository = new CharacterRepository(context); potionController = new PotionController(potionRepository, mapper); weaponController = new WeaponController(weaponRepository, mapper); armorController = new ArmorController(armorRepository, mapper); characterController = new CharacterController(characterRepository, mapper); }
public void UpdatePotion() { PotionRepository repo = new PotionRepository(new PotionSQLContext()); Potion c = repo.GetById(1); c.Stats.Spirit += 20; int spirit = c.Stats.Spirit; repo.Update(c); c = repo.GetById(1); Assert.AreEqual(c.Stats.Spirit, spirit, "Potion wasn't updated."); c.Stats.Spirit -= 20; repo.Update(c); }
public PotionQuery(PotionRepository potionRepository) { Field <ListGraphType <PotionType> >( "potions", resolve: context => potionRepository.GetAll() ); Field <PotionType>( "potion", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => { var id = context.GetArgument <int>("id"); return(potionRepository.Get(id)); } ); }
public PotionController(PotionRepository repo, Mapper mapper) { _repo = repo; _mapper = mapper; }