2 // ContractDescriptionTest.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2005 Novell, Inc. http://www.novell.com
8 // Copyright (C) 2011 Xamarin, Inc. http://xamarin.com
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Collections.ObjectModel;
32 using System.Net.Security;
33 using System.Reflection;
34 using System.ServiceModel;
35 using System.ServiceModel.Channels;
36 using System.ServiceModel.Description;
37 using NUnit.Framework;
39 namespace MonoTests.System.ServiceModel.Description
42 public class ContractDescriptionTest
45 [ExpectedException (typeof (InvalidOperationException))]
46 public void GetNonContract ()
48 ContractDescription cd = ContractDescription.GetContract (
53 public void GetContract ()
55 InternalTestGetContract (
56 ContractDescription.GetContract (typeof (IFoo)));
60 public void GetContractParamRenamed ()
62 ContractDescription cd = ContractDescription.GetContract (typeof (IFooMsgParams));
64 Assert.AreEqual (1, cd.Operations.Count, "Operation count");
67 OperationDescription od = cd.Operations [0];
69 ServiceAssert.AssertOperationDescription (
71 typeof (IFooMsgParams).GetMethod ("Foo"),
75 // Operation #1 -> Message #1
76 MessageDescription md = od.Messages [0];
78 ServiceAssert.AssertMessageAndBodyDescription (
79 "http://tempuri.org/IFooMsgParams/MyFoo",
80 MessageDirection.Input,
81 null, "MyFoo", "http://tempuri.org/", false,
84 ServiceAssert.AssertMessagePartDescription (
85 "MyParam", "http://tempuri.org/", 0, false,
86 ProtectionLevel.None, typeof (string), md.Body.Parts [0], "MyFoo.msg");
90 ServiceAssert.AssertMessageAndBodyDescription (
91 "http://tempuri.org/IFooMsgParams/MyFooResponse",
92 MessageDirection.Output,
93 null, "MyFooResponse",
94 "http://tempuri.org/", true,
97 ServiceAssert.AssertMessagePartDescription (
98 "MyResult", "http://tempuri.org/", 0, false,
99 ProtectionLevel.None, typeof (string), md.Body.ReturnValue, "MyResult ReturnValue");
103 public void GetContractConfigName ()
105 ContractDescription cd = ContractDescription.GetContract (typeof (ICtorUseCase2));
106 Assert.AreEqual("CtorUseCase2", cd.ConfigurationName);
107 Assert.AreEqual("ICtorUseCase2", cd.Name);
108 cd = ContractDescription.GetContract (typeof (ICtorUseCase1));
109 Assert.AreEqual("MonoTests.System.ServiceModel.ICtorUseCase1", cd.ConfigurationName);
110 Assert.AreEqual("ICtorUseCase1", cd.Name);
114 public void GetContract2 ()
116 InternalTestGetContract (
117 ContractDescription.GetContract (typeof (Foo)));
120 public void InternalTestGetContract (ContractDescription cd)
122 ServiceAssert.AssertContractDescription (
123 "IFoo", "http://tempuri.org/", SessionMode.Allowed, typeof (IFoo), null,
126 Assert.AreEqual (2, cd.Operations.Count, "Operation count");
129 OperationDescription od = cd.Operations [0];
131 ServiceAssert.AssertOperationDescription (
132 "HeyDude", null, null,
133 typeof (IFoo).GetMethod ("HeyDude"),
137 // Operation #1 -> Message #1
138 MessageDescription md = od.Messages [0];
140 ServiceAssert.AssertMessageAndBodyDescription (
141 "http://tempuri.org/IFoo/HeyDude",
142 MessageDirection.Input,
143 null, "HeyDude", "http://tempuri.org/", false,
146 ServiceAssert.AssertMessagePartDescription (
147 "msg", "http://tempuri.org/", 0, false,
148 ProtectionLevel.None, typeof (string), md.Body.Parts [0], "HeyDude.msg");
149 ServiceAssert.AssertMessagePartDescription (
150 "msg2", "http://tempuri.org/", 1, false,
151 ProtectionLevel.None, typeof (string), md.Body.Parts [1], "HeyDude.msg");
153 // Operation #1 -> Message #2
154 md = od.Messages [1];
156 ServiceAssert.AssertMessageAndBodyDescription (
157 "http://tempuri.org/IFoo/HeyDudeResponse",
158 MessageDirection.Output,
159 null, "HeyDudeResponse",
160 "http://tempuri.org/", true,
163 ServiceAssert.AssertMessagePartDescription (
164 "HeyDudeResult", "http://tempuri.org/", 0, false,
165 ProtectionLevel.None, typeof (string), md.Body.ReturnValue, "HeyDudeResponse ReturnValue");
168 od = cd.Operations [1];
170 ServiceAssert.AssertOperationDescription (
171 "HeyHey", null, null,
172 typeof (IFoo).GetMethod ("HeyHey"),
176 // Operation #2 -> Message #1
177 md = od.Messages [0];
179 ServiceAssert.AssertMessageAndBodyDescription (
180 "http://tempuri.org/IFoo/HeyHey",
181 MessageDirection.Input,
182 null, "HeyHey", "http://tempuri.org/", false,
185 ServiceAssert.AssertMessagePartDescription (
186 "ref1", "http://tempuri.org/", 0, false,
187 ProtectionLevel.None, typeof (string), md.Body.Parts [0], "HeyHey.ref1");
189 // Operation #2 -> Message #2
190 md = od.Messages [1];
192 ServiceAssert.AssertMessageAndBodyDescription (
193 "http://tempuri.org/IFoo/HeyHeyResponse",
194 MessageDirection.Output,
195 null, "HeyHeyResponse",
196 "http://tempuri.org/", true,
199 ServiceAssert.AssertMessagePartDescription (
200 "HeyHeyResult", "http://tempuri.org/", 0, false,
201 ProtectionLevel.None, typeof (void), md.Body.ReturnValue, "HeyHeyResponse ReturnValue");
203 ServiceAssert.AssertMessagePartDescription (
204 "out1", "http://tempuri.org/", 0, false,
205 ProtectionLevel.None, typeof (string), md.Body.Parts [0], "HeyHey.out1");
206 ServiceAssert.AssertMessagePartDescription (
207 "ref1", "http://tempuri.org/", 1, false,
208 ProtectionLevel.None, typeof (string), md.Body.Parts [1], "HeyHey.ref1");
212 public void GetContractInherit ()
214 ContractDescription.GetContract (typeof (Foo));
218 [ExpectedException (typeof (InvalidOperationException))]
219 public void GetMultipleServiceContract ()
221 ContractDescription.GetContract (typeof (FooBar));
225 // [ExpectedException (typeof (InvalidOperationException))]
226 public void GetContractNoOperation ()
228 ContractDescription.GetContract (typeof (INoOperation));
232 [Category ("NotWorking")]
233 public void GetContractMessageParameter ()
235 ContractDescription cd = ContractDescription.GetContract (typeof (IMessageParameter));
237 ServiceAssert.AssertContractDescription (
238 "IMessageParameter", "http://tempuri.org/",
239 SessionMode.Allowed, typeof (IMessageParameter), null,
242 OperationDescription od = cd.Operations [0];
244 ServiceAssert.AssertOperationDescription (
245 "ReturnMessage", null, null,
246 typeof (IMessageParameter).GetMethod ("ReturnMessage"),
250 MessageDescription md = od.Messages [0];
252 ServiceAssert.AssertMessageAndBodyDescription (
253 "http://tempuri.org/IMessageParameter/ReturnMessage",
254 MessageDirection.Input,
255 // Body.WrapperName is null
256 null, null, null, false,
257 md, "ReturnMessage");
259 ServiceAssert.AssertMessagePartDescription (
260 "arg", "http://tempuri.org/", 0, false,
261 ProtectionLevel.None, typeof (Message), md.Body.Parts [0], "ReturnMessage input");
265 [ExpectedException (typeof (InvalidOperationException))]
266 public void GetContractInvalidAsync ()
268 ContractDescription.GetContract (typeof (IInvalidAsync));
272 // IMetadataExchange contains async patterns.
273 public void GetContractIMetadataExchange ()
275 ContractDescription cd = ContractDescription.GetContract (typeof (IMetadataExchange));
276 OperationDescription od = cd.Operations [0];
277 Assert.AreEqual (2, od.Messages.Count, "premise: message count");
278 foreach (MessageDescription md in od.Messages) {
279 if (md.Direction == MessageDirection.Input) {
280 Assert.AreEqual ("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get", md.Action, "#1-1");
281 Assert.AreEqual (1, md.Body.Parts.Count, "#1-2");
282 Assert.IsNull (md.Body.ReturnValue, "#1-3");
283 Assert.AreEqual (typeof (Message), md.Body.Parts [0].Type, "#1-4");
285 Assert.AreEqual ("http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse", md.Action, "#2-1");
286 Assert.AreEqual (0, md.Body.Parts.Count, "#2-2");
287 Assert.IsNotNull (md.Body.ReturnValue, "#2-3");
288 Assert.AreEqual (typeof (Message), md.Body.ReturnValue.Type, "#2-4");
294 // enable it if we want to become a compatibility kid. It has
295 // no ServiceContract, thus it should not be accepted. But
296 // there is an abuse of ChannelFactory<IRequestChannel> in
297 // MSDN documentations and probably examples.
298 [Category ("NotWorking")]
299 public void GetContractIRequestChannel ()
301 ContractDescription cd = ContractDescription.GetContract (typeof (IRequestChannel));
302 Assert.AreEqual (typeof (IRequestChannel), cd.ContractType, "#_1");
303 Assert.AreEqual ("IRequestChannel", cd.Name, "#_2");
304 Assert.AreEqual ("http://schemas.microsoft.com/2005/07/ServiceModel", cd.Namespace, "#_3");
305 Assert.AreEqual (false, cd.HasProtectionLevel, "#_4");
306 Assert.AreEqual (SessionMode.NotAllowed, cd.SessionMode, "#_5");
307 Assert.AreEqual (0, cd.Behaviors.Count, "#_6");
308 Assert.AreEqual (1, cd.Operations.Count, "#_7");
309 OperationDescription od = cd.Operations [0];
310 Assert.IsNull (od.SyncMethod, "#_8");
311 Assert.IsNull (od.BeginMethod, "#_9");
312 Assert.IsNull (od.EndMethod, "#_10");
313 Assert.AreEqual (false, od.IsOneWay, "#_11");
314 Assert.AreEqual (false, od.HasProtectionLevel, "#_12");
315 Assert.AreEqual ("Request", od.Name, "#_13");
316 Assert.AreEqual (true, od.IsInitiating, "#_14");
317 Assert.AreEqual (0, od.Behaviors.Count, "#_15");
318 Assert.AreEqual (2, od.Messages.Count, "#_16");
319 foreach (MessageDescription md in od.Messages) {
320 if (md.Direction == MessageDirection.Output) {
321 Assert.AreEqual ("*", md.Action, "#_17");
322 Assert.AreEqual (false, md.HasProtectionLevel, "#_18");
323 Assert.AreEqual (0, md.Headers.Count, "#_19");
324 Assert.AreEqual (0, md.Properties.Count, "#_20");
325 Assert.IsNull (md.MessageType, "#_21");
326 MessageBodyDescription mb = md.Body;
327 Assert.AreEqual (null, mb.WrapperName, "#_22");
328 Assert.AreEqual (null, mb.WrapperNamespace, "#_23");
329 Assert.IsNull (mb.ReturnValue, "#_24");
330 Assert.AreEqual (0, mb.Parts.Count, "#_25");
332 Assert.AreEqual ("*", md.Action, "#_17_");
333 Assert.AreEqual (false, md.HasProtectionLevel, "#_18_");
334 Assert.AreEqual (0, md.Headers.Count, "#_19_");
335 Assert.AreEqual (0, md.Properties.Count, "#_20_");
336 Assert.IsNull (md.MessageType, "#_21_");
337 MessageBodyDescription mb = md.Body;
338 Assert.AreEqual (null, mb.WrapperName, "#_22_");
339 Assert.AreEqual (null, mb.WrapperNamespace, "#_23_");
340 Assert.IsNull (mb.ReturnValue, "#_24_");
341 Assert.AreEqual (0, mb.Parts.Count, "#_25_");
347 [ExpectedException (typeof (InvalidOperationException))]
348 public void WrongAsyncEndContract ()
350 ContractDescription.GetContract (typeof (IWrongAsyncEndContract));
354 public void AsyncContract1 ()
356 ContractDescription cd =
357 ContractDescription.GetContract (typeof (IAsyncContract1));
358 Assert.AreEqual (1, cd.Operations.Count);
359 OperationDescription od = cd.Operations [0];
360 Assert.AreEqual ("Sum", od.Name, "#1");
361 Assert.IsNotNull (od.BeginMethod, "#2");
362 Assert.IsNotNull (od.EndMethod, "#3");
366 [ExpectedException (typeof (InvalidOperationException))]
367 public void DuplicateOperationNames ()
369 ContractDescription.GetContract (typeof (IDuplicateOperationNames));
373 [ExpectedException (typeof (InvalidOperationException))]
374 public void AsyncMethodNameDoesNotStartWithBegin ()
376 ContractDescription.GetContract (typeof (IAsyncMethodNameDoesNotStartWithBegin));
380 [ExpectedException (typeof (InvalidOperationException))]
381 public void AsyncNameDoesNotStartWithBeginButExplicitName ()
383 // it is still invalid ...
384 ContractDescription.GetContract (typeof (IAsyncNameDoesNotStartWithBeginButExplicitName));
388 public void MessageBodyMemberIsNotInferred ()
390 ContractDescription cd = ContractDescription.GetContract (typeof (MessageBodyMemberIsNotInferredService));
391 OperationDescription od = cd.Operations [0];
392 MessageDescription md = od.Messages [0];
393 Assert.AreEqual (0, md.Body.Parts.Count);
397 public void TestContractFromObject () {
398 ContractDescription cd = ContractDescription.GetContract (typeof (Foo));
399 ServiceAssert.AssertContractDescription (typeof (IFoo).Name, "http://tempuri.org/", SessionMode.Allowed, typeof (IFoo), null, cd, "#1");
400 Assert.AreEqual (cd.Operations.Count, 2);
401 OperationBehaviorAttribute op = cd.Operations.Find ("HeyHey").Behaviors.Find<OperationBehaviorAttribute> ();
402 Assert.IsNotNull (op);
404 op.ReleaseInstanceMode,
405 ReleaseInstanceMode.None, "#2");
407 cd = ContractDescription.GetContract (typeof (IFoo), typeof (Foo));
408 ServiceAssert.AssertContractDescription (typeof (IFoo).Name, "http://tempuri.org/", SessionMode.Allowed, typeof (IFoo), null, cd, "#3");
409 Assert.AreEqual (cd.Operations.Count, 2, "#4");
411 cd.Operations.Find ("HeyHey").Behaviors.Find<OperationBehaviorAttribute> ().ReleaseInstanceMode,
412 ReleaseInstanceMode.AfterCall, "#5");
416 public void GetDerivedContract ()
418 var cd = ContractDescription.GetContract (typeof (IFoo3));
419 Assert.AreEqual (typeof (IFoo3), cd.ContractType, "#1");
420 Assert.AreEqual (3, cd.Operations.Count, "#2");
421 cd = ContractDescription.GetContract (typeof (Foo3));
422 Assert.AreEqual (typeof (IFoo3), cd.ContractType, "#3");
423 Assert.AreEqual (3, cd.Operations.Count, "#4");
427 public void MultipleContractsInTypeHierarchy ()
429 ContractDescription.GetContract (typeof (DuplicateCheckClassWrapper.ServiceInterface));
431 var host = new ServiceHost (typeof (DuplicateCheckClassWrapper.DummyService)); // fine in MS, fails in Mono with "A contract cannot have two operations that have the identical names and different set of parameters"
435 public void GetInheritedContracts ()
437 var cd = ContractDescription.GetContract (typeof (IService));
438 var ccd = cd.GetInheritedContracts ();
439 Assert.AreEqual (1, ccd.Count, "#1");
440 Assert.AreEqual (typeof (IServiceBase), ccd [0].ContractType, "#2");
444 public void InheritedContractAndNamespaces ()
446 var cd = ContractDescription.GetContract (typeof (IService));
447 Assert.IsTrue (cd.Operations.Any (od => od.Messages.Any (md => md.Action == "http://tempuri.org/IServiceBase/Say")), "#1"); // inherited
448 Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof (IService).GetMethod ("Join") && od.Messages.Any (md => md.Action == "http://tempuri.org/IService/Join")), "#2"); // self
449 Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof (IService2).GetMethod ("Join") && od.Messages.Any (md => md.Action == "http://tempuri.org/IService/Join")), "#3"); // callback
453 public void AsyncContractWithSymmetricCallbackContract ()
455 var cd = ContractDescription.GetContract (typeof(IAsyncContractWithSymmetricCallbackContract));
456 Assert.AreEqual (2, cd.Operations.Count, "#1");
457 Assert.AreSame (typeof (IAsyncContractWithSymmetricCallbackContract), cd.ContractType, "#2");
458 Assert.AreSame (typeof (IAsyncContractWithSymmetricCallbackContract), cd.CallbackContractType, "#3");
462 public void InheritingDuplexContract ()
464 var cd = ContractDescription.GetContract (typeof (IDerivedDuplexContract));
465 Assert.AreEqual (4, cd.Operations.Count, "#1");
466 Assert.AreSame (typeof (IDerivedDuplexContract), cd.ContractType, "#2");
467 Assert.AreSame (typeof (IDerivedDuplexCallback), cd.CallbackContractType, "#3");
468 Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof (IBaseDuplexCallback).GetMethod ("CallbackMethod")), "#4");
469 Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof (IDerivedDuplexCallback).GetMethod ("CallbackSomething")), "#5");
470 Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof (IBaseDuplexContract).GetMethod ("ContractMethod")), "#6");
471 Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof (IDerivedDuplexContract).GetMethod ("Something")), "#7");
475 public void SymmetricInheritingContract ()
477 var cd = ContractDescription.GetContract (typeof(ISymmetricInheritance));
478 Assert.AreEqual (4, cd.Operations.Count, "#1");
479 Assert.AreSame (typeof (ISymmetricInheritance), cd.ContractType, "#2");
480 Assert.AreSame (typeof (ISymmetricInheritance), cd.CallbackContractType, "#3");
481 Assert.AreEqual (2, cd.Operations.Count(od => od.SyncMethod == typeof (IAsyncContractWithSymmetricCallbackContract).GetMethod ("Foo")), "#4");
482 Assert.AreEqual (2, cd.Operations.Count(od => od.SyncMethod == typeof (ISymmetricInheritance).GetMethod ("Bar")), "#5");
486 public void DeepContractHierarchyTest ()
488 var cd = ContractDescription.GetContract (typeof(IDeepContractHierarchy));
489 Assert.AreEqual (6, cd.Operations.Count, "#1");
490 Assert.AreSame (typeof (IDeepContractHierarchy), cd.ContractType, "#2");
491 Assert.AreSame (typeof (IDeepContractHierarchy), cd.CallbackContractType, "#3");
495 public void MessageContractAttributes ()
497 var cd = ContractDescription.GetContract (typeof (IFoo2));
498 var od = cd.Operations.First (o => o.Name == "Nanoda");
499 var md = od.Messages.First (m => m.Direction == MessageDirection.Input);
500 Assert.AreEqual (typeof (OregoMessage), md.MessageType, "message type");
501 Assert.AreEqual ("http://tempuri.org/IFoo2/Nanoda", md.Action, "action");
502 Assert.AreEqual (1, md.Headers.Count, "headers");
503 Assert.AreEqual (3, md.Body.Parts.Count, "body parts");
504 Assert.AreEqual (0, md.Properties.Count, "properties");
507 // .NET complains: The operation Nanoda2 either has a parameter or a return type that is attributed with MessageContractAttribute. In order to represent the request message using a Message Contract, the operation must have a single parameter attributed with MessageContractAttribute. In order to represent the response message using a Message Contract, the operation's return value must be a type that is attributed with MessageContractAttribute and the operation may not have any out or ref parameters.
509 [ExpectedException (typeof (InvalidOperationException))]
510 public void MessageContractAttributes2 ()
512 ContractDescription.GetContract (typeof (IFoo2_2));
516 public void MessageContractAttributes3 ()
518 ContractDescription.GetContract (typeof (IFoo2_3));
522 public void MessageContractAttributes4 ()
524 ContractDescription.GetContract (typeof (IFoo2_4));
528 public void MessageContractAttributes5 ()
530 ContractDescription.GetContract (typeof (IFoo2_5));
534 public void MessageContractAttributes6 ()
536 ContractDescription.GetContract (typeof (IFoo2_6));
540 public void XmlSerializedOperation ()
542 var cd = ContractDescription.GetContract (typeof (XmlSerializedService));
543 var od = cd.Operations.First ();
544 var xb = od.Behaviors.Find<XmlSerializerOperationBehavior> ();
545 Assert.IsNotNull (xb, "#1");
549 public void MessageParameterDescriptionInUse ()
552 var cd = ContractDescription.GetContract (typeof (Dealerinfo.wsvDealerinfo.WSVDealerInfoServices));
553 foreach (var od in cd.Operations)
554 foreach (var md in od.Messages)
555 if (md.Action == "*") // return
556 Assert.IsNotNull (md.Body.ReturnValue, od.Name);
560 public void BugX206Contract ()
562 var cd = ContractDescription.GetContract (typeof (BugX206Service));
563 bool examined = false;
564 foreach (var md in cd.Operations.First ().Messages) {
565 if (md.Direction == MessageDirection.Input)
567 var pd = md.Body.ReturnValue;
568 Assert.IsNotNull (pd, "#1");
569 Assert.AreEqual ("DoWorkResult", pd.Name, "#2");
570 Assert.IsNull (pd.MemberInfo, "#3");
571 Assert.AreEqual (typeof (void), pd.Type, "#4");
574 Assert.IsTrue (examined, "end");
577 // It is for testing attribute search in interfaces.
578 public class Foo : IFoo
580 public string HeyDude (string msg, string msg2)
585 [OperationBehavior (ReleaseInstanceMode = ReleaseInstanceMode.AfterCall)]
586 public void HeyHey (out string out1, ref string ref1)
592 // It inherits both IFoo and IBar, thus cannot be a contract.
593 public class FooBar : IFoo, IBar
595 public string HeyDude (string msg, string msg2)
600 public void HeyHey (out string out1, ref string ref1)
605 public void OpenBar () {}
609 public interface IFoo
612 string HeyDude (string msg, string msg2);
615 void HeyHey (out string out1, ref string ref1);
619 public interface IFoo2
621 // FIXME: it does not pass yet
623 OregoMessage Nanoda (OregoMessage msg);
625 // FIXME: it does not pass yet
627 Mona NewMona (Mona source);
631 public interface IFoo2_2
633 [OperationContract] // wrong operation contract, must have only one parameter with MessageContractAttribute
634 OregoMessage Nanoda2 (OregoMessage msg1, OregoMessage msg2);
638 public interface IFoo2_3
641 string Nanoda2 (OregoMessage msg1);
645 public interface IFoo2_4
648 OregoMessage Nanoda2 (string s, string s2);
652 public interface IFoo2_5
655 Message Nanoda2 (OregoMessage msg1);
659 public interface IFoo2_6
662 OregoMessage Nanoda2 (Message msg1);
666 public interface IFoo3 : IFoo
669 string HeyMan (string msg, string msg2);
672 public class Foo3 : Foo, IFoo3
674 public string HeyMan (string msg, string msg2)
681 public interface IBar
688 public class OregoMessage
693 public string Neutral;
696 [MessageBodyMember] // it should be ignored ...
697 public string Setter { set { } }
698 public string NonMember;
703 public string OmaeMona;
704 public string OreMona;
708 public interface INoOperation
713 public interface IMessageParameter
716 Message ReturnMessage (Message arg);
720 public interface IInvalidAsync
723 Message ReturnMessage (Message arg);
725 [OperationContract (AsyncPattern = true)]
726 IAsyncResult BeginReturnMessage (Message arg, AsyncCallback callback, object state);
728 // and no EndReturnMessage().
732 public interface IWrongAsyncEndContract
735 int Sum (int a, int b);
737 [OperationContract (AsyncPattern = true)]
738 IAsyncResult BeginSum (int a, int b, AsyncCallback cb, object state);
740 // this OperationContractAttribute is not allowed.
741 [OperationContract (AsyncPattern = true)]
742 int EndSum (IAsyncResult result);
746 public interface IAsyncContract1
749 int Sum (int a, int b);
751 [OperationContract (AsyncPattern = true)]
752 IAsyncResult BeginSum (int a, int b, AsyncCallback cb, object state);
754 int EndSum (IAsyncResult result);
758 public interface IAsyncMethodNameDoesNotStartWithBegin
761 int Sum (int a, int b);
763 [OperationContract (AsyncPattern = true)]
764 IAsyncResult StartSum (int a, int b, AsyncCallback cb, object state);
766 int EndSum (IAsyncResult result);
770 public interface IAsyncNameDoesNotStartWithBeginButExplicitName
773 int Sum (int a, int b);
775 [OperationContract (Name = "Sum", AsyncPattern = true)]
776 IAsyncResult StartSum (int a, int b, AsyncCallback cb, object state);
778 int EndSum (IAsyncResult result);
782 public interface IDuplicateOperationNames
785 string Echo (string s);
788 string Echo (string s1, string s2);
792 public interface IFooMsgParams
794 [OperationContract (Name = "MyFoo")]
795 [return: MessageParameter (Name = "MyResult")]
796 string Foo ([MessageParameter (Name = "MyParam")] string param);
800 public class MessageBodyMemberIsNotInferredService
803 public void Echo (MessageBodyMemberIsNotInferredContract msg)
809 public class MessageBodyMemberIsNotInferredContract
818 public class DuplicateCheckClassWrapper
822 internal interface ServiceInterface : Foo
827 internal interface Foo : Bar
829 [OperationContract] void Foo();
833 internal interface Bar
835 [OperationContract] void FooBar();
838 internal class DummyService : ServiceInterface
840 public void FooBar() { }
842 public void Foo() { }
847 public interface IServiceBase
849 [OperationContract (IsOneWay = true)]
850 void Say (string word);
853 [ServiceContract (CallbackContract = typeof (IService2))]
854 public interface IService : IServiceBase
861 public interface IServiceBase2
863 [OperationContract (IsOneWay = true)]
864 void Say (string word);
868 public interface IService2 : IServiceBase2
874 [ServiceContract (CallbackContract = typeof (IAsyncContractWithSymmetricCallbackContract))]
875 public interface IAsyncContractWithSymmetricCallbackContract
880 [OperationContract (AsyncPattern = true)]
881 IAsyncResult BeginFoo (AsyncCallback callback, object asyncState);
883 void EndFoo (IAsyncResult result);
886 [ServiceContract (CallbackContract = typeof (ISymmetricInheritance))]
887 public interface ISymmetricInheritance : IAsyncContractWithSymmetricCallbackContract
892 [OperationContract (AsyncPattern = true)]
893 IAsyncResult BeginBar (AsyncCallback callback, object asyncState);
895 void EndBar (IAsyncResult result);
898 [ServiceContract (CallbackContract = typeof (IDeepContractHierarchy))]
899 public interface IDeepContractHierarchy : ISymmetricInheritance
905 public interface IBaseDuplexCallback
908 void CallbackMethod ();
911 [ServiceContract (CallbackContract = typeof (IBaseDuplexCallback))]
912 public interface IBaseDuplexContract
915 void ContractMethod ();
918 public interface IDerivedDuplexCallback : IBaseDuplexCallback
921 void CallbackSomething ();
924 [ServiceContract (CallbackContract = typeof(IDerivedDuplexCallback))]
925 public interface IDerivedDuplexContract : IBaseDuplexContract
932 public interface XmlSerializedService
935 [XmlSerializerFormat]
936 string Echo (string input);
940 public interface BugX206Service
943 BugX206Response DoWork ();
946 [MessageContract (IsWrapped = true)]
947 public partial class BugX206Response