public void GetContractMessageParameter() { ContractDescription cd = ContractDescription.GetContract(typeof(IMessageParameter)); ServiceAssert.AssertContractDescription( "IMessageParameter", "http://tempuri.org/", SessionMode.Allowed, typeof(IMessageParameter), null, cd, "contract"); OperationDescription od = cd.Operations [0]; ServiceAssert.AssertOperationDescription( "ReturnMessage", null, null, typeof(IMessageParameter).GetMethod("ReturnMessage"), true, false, false, od, "operation"); MessageDescription md = od.Messages [0]; ServiceAssert.AssertMessageAndBodyDescription( "http://tempuri.org/IMessageParameter/ReturnMessage", MessageDirection.Input, // Body.WrapperName is null null, null, null, false, md, "ReturnMessage"); ServiceAssert.AssertMessagePartDescription( "arg", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(Message), md.Body.Parts [0], "ReturnMessage input"); }
public void GetContractParamRenamed() { ContractDescription cd = ContractDescription.GetContract(typeof(IFooMsgParams)); Assert.AreEqual(1, cd.Operations.Count, "Operation count"); // Operation #1 OperationDescription od = cd.Operations [0]; ServiceAssert.AssertOperationDescription( "MyFoo", null, null, typeof(IFooMsgParams).GetMethod("Foo"), true, false, false, od, "MyFoo"); // Operation #1 -> Message #1 MessageDescription md = od.Messages [0]; ServiceAssert.AssertMessageAndBodyDescription( "http://tempuri.org/IFooMsgParams/MyFoo", MessageDirection.Input, null, "MyFoo", "http://tempuri.org/", false, md, "MyFoo"); ServiceAssert.AssertMessagePartDescription( "MyParam", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(string), md.Body.Parts [0], "MyFoo.msg"); md = od.Messages [1]; ServiceAssert.AssertMessageAndBodyDescription( "http://tempuri.org/IFooMsgParams/MyFooResponse", MessageDirection.Output, null, "MyFooResponse", "http://tempuri.org/", true, md, "MyFoo"); ServiceAssert.AssertMessagePartDescription( "MyResult", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(string), md.Body.ReturnValue, "MyResult ReturnValue"); }
public void InternalTestGetContract(ContractDescription cd) { ServiceAssert.AssertContractDescription( "IFoo", "http://tempuri.org/", SessionMode.Allowed, typeof(IFoo), null, cd, "contract"); Assert.AreEqual(2, cd.Operations.Count, "Operation count"); // Operation #1 OperationDescription od = cd.Operations [0]; ServiceAssert.AssertOperationDescription( "HeyDude", null, null, typeof(IFoo).GetMethod("HeyDude"), true, false, false, od, "HeyDude"); // Operation #1 -> Message #1 MessageDescription md = od.Messages [0]; ServiceAssert.AssertMessageAndBodyDescription( "http://tempuri.org/IFoo/HeyDude", MessageDirection.Input, null, "HeyDude", "http://tempuri.org/", false, md, "HeyDude"); ServiceAssert.AssertMessagePartDescription( "msg", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(string), md.Body.Parts [0], "HeyDude.msg"); ServiceAssert.AssertMessagePartDescription( "msg2", "http://tempuri.org/", 1, false, ProtectionLevel.None, typeof(string), md.Body.Parts [1], "HeyDude.msg"); // Operation #1 -> Message #2 md = od.Messages [1]; ServiceAssert.AssertMessageAndBodyDescription( "http://tempuri.org/IFoo/HeyDudeResponse", MessageDirection.Output, null, "HeyDudeResponse", "http://tempuri.org/", true, md, "HeyDude"); ServiceAssert.AssertMessagePartDescription( "HeyDudeResult", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(string), md.Body.ReturnValue, "HeyDudeResponse ReturnValue"); // Operation #2 od = cd.Operations [1]; ServiceAssert.AssertOperationDescription( "HeyHey", null, null, typeof(IFoo).GetMethod("HeyHey"), true, false, false, od, "HeyHey"); // Operation #2 -> Message #1 md = od.Messages [0]; ServiceAssert.AssertMessageAndBodyDescription( "http://tempuri.org/IFoo/HeyHey", MessageDirection.Input, null, "HeyHey", "http://tempuri.org/", false, md, "HeyHey"); ServiceAssert.AssertMessagePartDescription( "ref1", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(string), md.Body.Parts [0], "HeyHey.ref1"); // Operation #2 -> Message #2 md = od.Messages [1]; ServiceAssert.AssertMessageAndBodyDescription( "http://tempuri.org/IFoo/HeyHeyResponse", MessageDirection.Output, null, "HeyHeyResponse", "http://tempuri.org/", true, md, "HeyHey"); ServiceAssert.AssertMessagePartDescription( "HeyHeyResult", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(void), md.Body.ReturnValue, "HeyHeyResponse ReturnValue"); ServiceAssert.AssertMessagePartDescription( "out1", "http://tempuri.org/", 0, false, ProtectionLevel.None, typeof(string), md.Body.Parts [0], "HeyHey.out1"); ServiceAssert.AssertMessagePartDescription( "ref1", "http://tempuri.org/", 1, false, ProtectionLevel.None, typeof(string), md.Body.Parts [1], "HeyHey.ref1"); }