Example #1
0
        public void Name_Set_Get()
        {
            var chest = new SerializableChest();

            chest.Name = "test";

            Assert.Equal("test", chest.Name);
        }
Example #2
0
        public void Y_Set_Get()
        {
            var chest = new SerializableChest();

            chest.Y = 100;

            Assert.Equal(100, chest.Y);
        }
Example #3
0
        public void X_Set_Get()
        {
            var chest = new SerializableChest();

            chest.X = 256;

            Assert.Equal(256, chest.X);
        }
Example #4
0
        public void Index_Set_Get()
        {
            var chest = new SerializableChest();

            chest.Index = 5;

            Assert.Equal(5, chest.Index);
        }
Example #5
0
        public void Read()
        {
            var length = SerializableChest.Read(_bytes, out var chest);

            Assert.Equal(_bytes.Length, length);

            Assert.Equal(5, chest.Index);
            Assert.Equal(256, chest.X);
            Assert.Equal(100, chest.Y);
            Assert.Equal("test", chest.Name);

            var bytes2  = new byte[1000];
            var length2 = chest.Write(bytes2);

            Assert.Equal(length, length2);
            Assert.Equal(_bytes, bytes2[..length2]);
Example #6
0
        public void Name_SetNullValue_ThrowsArgumentNullException()
        {
            var chest = new SerializableChest();

            Assert.Throws <ArgumentNullException>(() => chest.Name = null !);
        }
Example #7
0
        public void Name_GetNullValue()
        {
            var chest = new SerializableChest();

            Assert.Equal(string.Empty, chest.Name);
        }