public AbsItemTemplate(IItemTemplateConstArg arg)
 {
     CheckConstArgValidity(arg);
     this.pickupStepQuantity    = arg.pickupStepQuantity;
     this.maxEquippableQuantity = arg.maxEquippableQuantity;
     this.maxQuantityPerSlot    = arg.maxQuantityPerSlot;
 }
Example #2
0
    public TestItemTemplate CreateTestItemTemplate(int pickUpStepQ, int maxEquippableQ, int maxQPerSlot, out IItemTemplateConstArg arg)
    {
        IItemTemplateConstArg thisArg = Substitute.For <IItemTemplateConstArg>();

        thisArg.pickupStepQuantity.Returns(pickUpStepQ);
        thisArg.maxEquippableQuantity.Returns(maxEquippableQ);
        thisArg.maxQuantityPerSlot.Returns(maxQPerSlot);
        TestItemTemplate testItemTemplate = new TestItemTemplate(thisArg);

        arg = thisArg;
        return(testItemTemplate);
    }
        void CheckConstArgValidity(IItemTemplateConstArg arg)
        {
            int pickupStepQuantity = arg.pickupStepQuantity;

            if (pickupStepQuantity < 1)
            {
                throw new System.InvalidOperationException("pickupStepQuantity must be at least 1");
            }
            int maxEquippableQuantity = arg.maxEquippableQuantity;

            if (maxEquippableQuantity < 1)
            {
                throw new System.InvalidOperationException("maxEquippableQuantity must be at least 1");
            }
            int maxQuantityPerSlot = arg.maxQuantityPerSlot;

            if (maxQuantityPerSlot < 1)
            {
                throw new System.InvalidOperationException("maxQuantityPerSlot must be at least 1");
            }
        }
Example #4
0
 public TestItemTemplate(IItemTemplateConstArg arg) : base(arg)
 {
 }