You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -434,14 +434,12 @@ namespace MonoTests.System.ServiceModel
|
||||
Assert.AreEqual ("callResult", res.val, "#2");
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void ConstructorServiceEndpoint ()
|
||||
{
|
||||
// It is okay to pass ServiceEndpoint that does not have Binding or EndpointAddress.
|
||||
new ChannelFactory<IRequestChannel> (new ServiceEndpoint (ContractDescription.GetContract (typeof (IMetadataExchange)), null, null));
|
||||
}
|
||||
#endif
|
||||
|
||||
public T CreateFooComplexMC_Channel<T> (bool isXml)
|
||||
{
|
||||
|
||||
@@ -28,12 +28,16 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.ServiceModel.Description;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
@@ -479,7 +483,6 @@ namespace MonoTests.System.ServiceModel
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void ConstructorServiceEndpoint ()
|
||||
{
|
||||
@@ -504,6 +507,82 @@ namespace MonoTests.System.ServiceModel
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[SerializableAttribute ()]
|
||||
[XmlTypeAttribute (Namespace = "http://mono.com/")]
|
||||
public class ValueWithXmlAttributes
|
||||
{
|
||||
[XmlElementAttribute (ElementName = "Name")]
|
||||
public string FakeName;
|
||||
}
|
||||
|
||||
[ServiceContractAttribute (Namespace = "http://mono.com/")]
|
||||
public interface IXmlSerializerFormatService
|
||||
{
|
||||
[OperationContractAttribute (Action = "http://mono.com/Send", ReplyAction = "*")]
|
||||
[XmlSerializerFormatAttribute ()]
|
||||
void SendValueWithXmlAttributes (ValueWithXmlAttributes v);
|
||||
}
|
||||
|
||||
class XmlSerializerFormatClient : ClientBase<IXmlSerializerFormatService>
|
||||
{
|
||||
public XmlSerializerFormatClient (Binding binding, EndpointAddress address)
|
||||
: base (binding, address)
|
||||
{
|
||||
}
|
||||
|
||||
public void SendValue ()
|
||||
{
|
||||
var v = new ValueWithXmlAttributes () { FakeName = "name" };
|
||||
base.Channel.SendValueWithXmlAttributes (v);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestXmlAttributes ()
|
||||
{
|
||||
int port = NetworkHelpers.FindFreePort();
|
||||
var endpoint = new EndpointAddress ("http://localhost:" + port);
|
||||
var binding = new BasicHttpBinding ();
|
||||
var client = new XmlSerializerFormatClient (binding, endpoint);
|
||||
|
||||
var server = new TcpListener (IPAddress.Any, port);
|
||||
server.Start ();
|
||||
|
||||
var acceptTask = server.AcceptTcpClientAsync ();
|
||||
|
||||
var t1 = new Task( () => client.SendValue ());
|
||||
t1.Start();
|
||||
|
||||
if (!acceptTask.Wait (2000))
|
||||
Assert.Fail ("No request from client.");
|
||||
|
||||
var netStream = acceptTask.Result.GetStream ();
|
||||
|
||||
byte[] buffer = new byte [1024];
|
||||
int numBytesRead = 0;
|
||||
var message = new StringBuilder ();
|
||||
|
||||
do {
|
||||
numBytesRead = netStream.Read (buffer, 0, buffer.Length);
|
||||
var str = Encoding.UTF8.GetString (buffer, 0, numBytesRead);
|
||||
message.AppendFormat ("{0}", str);
|
||||
if (str.EndsWith ("</s:Envelope>", StringComparison.InvariantCulture))
|
||||
break;
|
||||
} while (numBytesRead > 0);
|
||||
|
||||
var messageStr = message.ToString ();
|
||||
var envelopeIndex = messageStr.IndexOf ("<s:Envelope");
|
||||
if (envelopeIndex < 0)
|
||||
Assert.Fail ("Soap envelope was not received.");
|
||||
|
||||
var envelope = messageStr.Substring (envelopeIndex);
|
||||
|
||||
var expected = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SendValueWithXmlAttributes xmlns=\"http://mono.com/\"><v><Name>name</Name></v></SendValueWithXmlAttributes></s:Body></s:Envelope>";
|
||||
|
||||
Assert.AreEqual (expected, envelope);
|
||||
|
||||
server.Stop ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,6 +213,13 @@ namespace MonoTests.System.ServiceModel
|
||||
Assert.IsTrue (Foo.JoinCalled, "#2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReaderQuotasDefault_Bug15153 ()
|
||||
{
|
||||
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
|
||||
binding.ReaderQuotas.MaxStringContentLength = 8192;
|
||||
}
|
||||
|
||||
[ServiceContract]
|
||||
public interface IFoo
|
||||
{
|
||||
|
||||
@@ -373,7 +373,6 @@ namespace MonoTests.System.ServiceModel
|
||||
return host;
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void AddServiceEndpoint_Directly ()
|
||||
{
|
||||
@@ -422,7 +421,6 @@ namespace MonoTests.System.ServiceModel
|
||||
var contract = ContractDescription.GetContract (typeof (INotImplementedService));
|
||||
host.AddServiceEndpoint (new ServiceEndpoint (contract, binding, address));
|
||||
}
|
||||
#endif
|
||||
|
||||
#region helpers
|
||||
|
||||
|
||||
@@ -353,6 +353,29 @@ namespace MonoTests.System.ServiceModel
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InstanceWithSingletonMode_InheritServiceBehavior ()
|
||||
{
|
||||
// # 37035
|
||||
|
||||
var ep = NetworkHelpers.LocalEphemeralEndPoint ().ToString ();
|
||||
|
||||
ChildSingletonService instance = new ChildSingletonService ();
|
||||
ServiceHost host = new ServiceHost (instance);
|
||||
|
||||
host.AddServiceEndpoint (typeof (SingletonService),
|
||||
new BasicHttpBinding (),
|
||||
new Uri ("http://" + ep + "/s3"));
|
||||
|
||||
try {
|
||||
host.Open ();
|
||||
} catch (InvalidOperationException ex) {
|
||||
Assert.Fail ("InstanceContextMode was not inherited from parent, exception was: {0}", ex);
|
||||
} finally {
|
||||
host.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
[ServiceContract]
|
||||
interface IBar
|
||||
{
|
||||
@@ -446,7 +469,14 @@ namespace MonoTests.System.ServiceModel
|
||||
public class SingletonService
|
||||
{
|
||||
[OperationContract]
|
||||
public void Process (string input)
|
||||
public virtual void Process (string input)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class ChildSingletonService : SingletonService
|
||||
{
|
||||
public override void Process (string input)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user