Ejemplo n.º 1
0
        public void PotionSelect()
        {
            PotionRepository repo = new PotionRepository(new PotionSQLContext());
            Potion           c    = repo.GetById(1);

            Assert.IsNotNull(c, "Potion wasn't correctly retrieved");
        }
Ejemplo n.º 2
0
        public void PotionsSelect()
        {
            PotionRepository repo = new PotionRepository(new PotionSQLContext());
            List <Potion>    c    = repo.GetAll();

            Assert.IsNotNull(c, "Potions weren't correctly retrieved");
        }
Ejemplo n.º 3
0
        // 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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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));
            }
                );
        }
Ejemplo n.º 6
0
 public PotionController(PotionRepository repo, Mapper mapper)
 {
     _repo   = repo;
     _mapper = mapper;
 }