[6/6] webservices/tests: Add message tests.

Hans Leidekker hans at codeweavers.com
Wed Jun 15 02:21:25 CDT 2016


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/webservices/tests/Makefile.in |  1 +
 dlls/webservices/tests/msg.c       | 74 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 dlls/webservices/tests/msg.c

diff --git a/dlls/webservices/tests/Makefile.in b/dlls/webservices/tests/Makefile.in
index c278a47..afff870 100644
--- a/dlls/webservices/tests/Makefile.in
+++ b/dlls/webservices/tests/Makefile.in
@@ -3,6 +3,7 @@ IMPORTS   = webservices
 
 C_SRCS = \
 	channel.c \
+	msg.c \
 	proxy.c \
 	reader.c \
 	url.c \
diff --git a/dlls/webservices/tests/msg.c b/dlls/webservices/tests/msg.c
new file mode 100644
index 0000000..852407c
--- /dev/null
+++ b/dlls/webservices/tests/msg.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016 Hans Leidekker for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdio.h>
+#include "windows.h"
+#include "webservices.h"
+#include "wine/test.h"
+
+static void test_WsCreateMessage(void)
+{
+    HRESULT hr;
+    WS_MESSAGE *msg;
+    WS_ENVELOPE_VERSION env_version;
+    WS_ADDRESSING_VERSION addr_version;
+    WS_MESSAGE_PROPERTY prop;
+
+    hr = WsCreateMessage( 0, 0, NULL, 0, NULL, NULL ) ;
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsCreateMessage( 0, 0, NULL, 0, &msg, NULL ) ;
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, 0, NULL, 0, &msg, NULL ) ;
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsCreateMessage( 0, WS_ENVELOPE_VERSION_SOAP_1_1, NULL, 0, &msg, NULL ) ;
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    env_version = WS_ENVELOPE_VERSION_SOAP_1_1;
+    prop.id = WS_MESSAGE_PROPERTY_ENVELOPE_VERSION;
+    prop.value = &env_version;
+    prop.valueSize = sizeof(env_version);
+    hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, WS_ENVELOPE_VERSION_SOAP_1_1, &prop,
+                          1, &msg, NULL ) ;
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, WS_ENVELOPE_VERSION_SOAP_1_1, NULL,
+                          0, &msg, NULL ) ;
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    env_version = 0xdeadbeef;
+    hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
+                               sizeof(env_version), NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+    ok( env_version == WS_ENVELOPE_VERSION_SOAP_1_1, "got %u\n", env_version );
+
+    addr_version = 0xdeadbeef;
+    hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ADDRESSING_VERSION, &addr_version,
+                               sizeof(addr_version), NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+    ok( addr_version == WS_ADDRESSING_VERSION_0_9, "got %u\n", addr_version );
+
+    WsFreeMessage( msg );
+}
+
+START_TEST(msg)
+{
+    test_WsCreateMessage();
+}
-- 
2.1.4




More information about the wine-patches mailing list