public void Items_Get_Item_GetInvalidIndex_ThrowsIndexOutOfRangeException(int index)
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(terrariaChest);

            Assert.Throws <IndexOutOfRangeException>(() => chest.Items[index]);
        }
Example #2
0
        public void IsActive_Get_ReturnsTrue()
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(terrariaChest);

            Assert.True(chest.IsActive);
        }
Example #3
0
        public void Name_SetNullValue_ThrowsArgumentNullException()
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(terrariaChest);

            Assert.Throws <ArgumentNullException>(() => chest.Name = null !);
        }
Example #4
0
        public void Index_Get()
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(1, terrariaChest);

            Assert.Equal(1, chest.Index);
        }
Example #5
0
        public void X_Get()
        {
            var terrariaChest = new Terraria.Chest {
                x = 256, y = 100, name = "test"
            };
            var chest = new OrionChest(terrariaChest);

            Assert.Equal(256, chest.X);
        }
Example #6
0
        public void Name_Set()
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(terrariaChest);

            chest.Name = "test";

            Assert.Equal("test", terrariaChest.name);
        }
Example #7
0
        public void Name_GetNullValue()
        {
            var terrariaChest = new Terraria.Chest {
                x = 256, y = 100, name = null
            };
            var chest = new OrionChest(terrariaChest);

            Assert.Equal(string.Empty, chest.Name);
        }
Example #8
0
        public void Y_Set()
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(terrariaChest);

            chest.Y = 100;

            Assert.Equal(100, terrariaChest.y);
        }
Example #9
0
        public void X_Set()
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(terrariaChest);

            chest.X = 256;

            Assert.Equal(256, terrariaChest.x);
        }
        public void Items_Get_Item_Get()
        {
            var terrariaChest = new Terraria.Chest();

            terrariaChest.item[0] = new Terraria.Item
            {
                type   = (int)ItemId.Sdmg,
                prefix = (byte)ItemPrefix.Unreal,
                stack  = 1
            };

            var chest = new OrionChest(terrariaChest);

            Assert.Equal(new ItemStack(ItemId.Sdmg, ItemPrefix.Unreal, 1), chest.Items[0]);
        }
Example #11
0
        /// <summary>
        /// Creates a Corruption.TEdit.Chest from a Terraria.Chest.
        /// </summary>
        /// <param name="tChest"></param>
        public Chest(Terraria.Chest tChest) : this(tChest.x, tChest.y, tChest.name)
        {
            for (int i = 0; i < MaxItems; i++)
            {
                var src = tChest.item[i];

                if (src != null)
                {
                    var dst = _items[i];

                    dst.NetId     = src.netID;
                    dst.Prefix    = src.prefix;
                    dst.StackSize = src.stack;
                }
            }
        }
        public void Items_Get_Item_Get_Null()
        {
            var terrariaChest = new Terraria.Chest();
            var chest         = new OrionChest(terrariaChest);

            Assert.Equal(default, chest.Items[0]);