Exemplo n.º 1
0
            public void Object_Of_T_Value()
            {
                CustomObject custom = new CustomObject
                {
                    Id      = 1,
                    Name    = "Object Class",
                    Time    = DateTime.Now,
                    Sellary = 999.99M,
                    Tags    = new[] { "a", "b", "c" },
                };

                byte[]       bytes     = custom.ToByteArray();
                CustomObject converted = bytes.ConvertTo <CustomObject>();

                Assert.AreEqual(custom.Id, converted.Id);
                Assert.AreEqual(custom.Name, converted.Name);
                Assert.AreEqual(custom.Time, converted.Time);
                Assert.AreEqual(custom.Sellary, converted.Sellary);
                Assert.AreEqual(custom.Tags.Length, converted.Tags.Length);
                for (int i = 0; i < custom.Tags.Length; i++)
                {
                    Assert.AreEqual(custom.Tags[i], converted.Tags[i]);
                }
            }
Exemplo n.º 2
0
            public void Null_Object_Of_T()
            {
                CustomObject nullObject = null;

                byte[] byteArray = nullObject.ToByteArray();
            }