Пример #1
0
        public void BinarySupport()
        {
            Assert.IsFalse(BinaryTypeUtility.IsTypeBinary(typeof(int)),
                           "Int32 isn't a Binary.");
            Assert.IsFalse(BinaryTypeUtility.IsTypeBinary(typeof(string)),
                           "String isn't a Binary.");
            Assert.IsTrue(BinaryTypeUtility.IsTypeBinary(typeof(Binary)),
                          "Binary is a Binary!");

            Assert.AreEqual(typeof(byte[]), SerializationUtility.GetClientType(typeof(Binary)),
                            "The client type for Binary is byte[].");

            byte[] bytes  = new byte[] { 10, 20, 30 };
            Binary binary = new Binary(bytes);

            Assert.IsTrue(bytes.SequenceEqual((IEnumerable <byte>)SerializationUtility.GetClientValue(typeof(byte[]), binary)),
                          "Client Binary values should be equal.");
            Assert.IsTrue(bytes.SequenceEqual((IEnumerable <byte>)SerializationUtility.GetClientValue(typeof(byte[]), bytes)),
                          "Client byte[] values should be equal.");
            Assert.AreEqual(binary, SerializationUtility.GetServerValue(typeof(Binary), binary),
                            "Server Binary values should be equal.");
            Assert.AreEqual(binary, SerializationUtility.GetServerValue(typeof(Binary), bytes),
                            "Server byte[] values should be equal.");
        }
Пример #2
0
 protected override object ConvertReturnValue(object returnValue)
 {
     return(SerializationUtility.GetClientValue(SerializationUtility.GetClientType(this.operation.ReturnType), returnValue));
 }