Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,288 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Dealerinfo.wsvDealerinfo {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://programcallbean.accentry.accell.nl", ConfigurationName="wsvDealerinfo.WSVDealerInfoServices")]
public interface WSVDealerInfoServices {
// CODEGEN: Parameter 'wsvdealerinfo_XMLReturn' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'.
[System.ServiceModel.OperationContractAttribute(Action="wsvdealerinfo_XML", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
[return: System.ServiceModel.MessageParameterAttribute(Name="wsvdealerinfo_XMLReturn")]
Dealerinfo.wsvDealerinfo.wsvdealerinfo_XMLResponse wsvdealerinfo_XML(Dealerinfo.wsvDealerinfo.wsvdealerinfo_XMLRequest request);
// CODEGEN: Parameter 'wsvdealerinfoReturn' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'.
[System.ServiceModel.OperationContractAttribute(Action="wsvdealerinfo", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
[return: System.ServiceModel.MessageParameterAttribute(Name="wsvdealerinfoReturn")]
Dealerinfo.wsvDealerinfo.wsvdealerinfoResponse wsvdealerinfo(Dealerinfo.wsvDealerinfo.wsvdealerinfoRequest request);
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://programcallbean.accentry.accell.nl")]
public partial class WSVDealerInfoInput : object, System.ComponentModel.INotifyPropertyChanged {
private string returncodeField;
private string wSVBedrijfscodeField;
private string wSVDealercodeField;
private string wSVWachtwoordField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=0)]
public string returncode {
get {
return this.returncodeField;
}
set {
this.returncodeField = value;
this.RaisePropertyChanged("returncode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=1)]
public string WSVBedrijfscode {
get {
return this.wSVBedrijfscodeField;
}
set {
this.wSVBedrijfscodeField = value;
this.RaisePropertyChanged("WSVBedrijfscode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=2)]
public string WSVDealercode {
get {
return this.wSVDealercodeField;
}
set {
this.wSVDealercodeField = value;
this.RaisePropertyChanged("WSVDealercode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=3)]
public string WSVWachtwoord {
get {
return this.wSVWachtwoordField;
}
set {
this.wSVWachtwoordField = value;
this.RaisePropertyChanged("WSVWachtwoord");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://programcallbean.accentry.accell.nl")]
public partial class WSVDealerInfoResult : object, System.ComponentModel.INotifyPropertyChanged {
private string returncodeField;
private string wSVFoutmeldingField;
private string wSVDealerinfoField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=0)]
public string returncode {
get {
return this.returncodeField;
}
set {
this.returncodeField = value;
this.RaisePropertyChanged("returncode");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=1)]
public string WSVFoutmelding {
get {
return this.wSVFoutmeldingField;
}
set {
this.wSVFoutmeldingField = value;
this.RaisePropertyChanged("WSVFoutmelding");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=2)]
public string WSVDealerinfo {
get {
return this.wSVDealerinfoField;
}
set {
this.wSVDealerinfoField = value;
this.RaisePropertyChanged("WSVDealerinfo");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="wsvdealerinfo_XML", WrapperNamespace="http://programcallbean.accentry.accell.nl", IsWrapped=true)]
public partial class wsvdealerinfo_XMLRequest {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://programcallbean.accentry.accell.nl", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public Dealerinfo.wsvDealerinfo.WSVDealerInfoInput inputData;
public wsvdealerinfo_XMLRequest() {
}
public wsvdealerinfo_XMLRequest(Dealerinfo.wsvDealerinfo.WSVDealerInfoInput inputData) {
this.inputData = inputData;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="wsvdealerinfo_XMLResponse", WrapperNamespace="http://programcallbean.accentry.accell.nl", IsWrapped=true)]
public partial class wsvdealerinfo_XMLResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://programcallbean.accentry.accell.nl", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string wsvdealerinfo_XMLReturn;
public wsvdealerinfo_XMLResponse() {
}
public wsvdealerinfo_XMLResponse(string wsvdealerinfo_XMLReturn) {
this.wsvdealerinfo_XMLReturn = wsvdealerinfo_XMLReturn;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="wsvdealerinfo", WrapperNamespace="http://programcallbean.accentry.accell.nl", IsWrapped=true)]
public partial class wsvdealerinfoRequest {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://programcallbean.accentry.accell.nl", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public Dealerinfo.wsvDealerinfo.WSVDealerInfoInput inputData;
public wsvdealerinfoRequest() {
}
public wsvdealerinfoRequest(Dealerinfo.wsvDealerinfo.WSVDealerInfoInput inputData) {
this.inputData = inputData;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="wsvdealerinfoResponse", WrapperNamespace="http://programcallbean.accentry.accell.nl", IsWrapped=true)]
public partial class wsvdealerinfoResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://programcallbean.accentry.accell.nl", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public Dealerinfo.wsvDealerinfo.WSVDealerInfoResult wsvdealerinfoReturn;
public wsvdealerinfoResponse() {
}
public wsvdealerinfoResponse(Dealerinfo.wsvDealerinfo.WSVDealerInfoResult wsvdealerinfoReturn) {
this.wsvdealerinfoReturn = wsvdealerinfoReturn;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface WSVDealerInfoServicesChannel : Dealerinfo.wsvDealerinfo.WSVDealerInfoServices, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class WSVDealerInfoServicesClient : System.ServiceModel.ClientBase<Dealerinfo.wsvDealerinfo.WSVDealerInfoServices>, Dealerinfo.wsvDealerinfo.WSVDealerInfoServices {
public WSVDealerInfoServicesClient() {
}
public WSVDealerInfoServicesClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public WSVDealerInfoServicesClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public WSVDealerInfoServicesClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public WSVDealerInfoServicesClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
Dealerinfo.wsvDealerinfo.wsvdealerinfo_XMLResponse Dealerinfo.wsvDealerinfo.WSVDealerInfoServices.wsvdealerinfo_XML(Dealerinfo.wsvDealerinfo.wsvdealerinfo_XMLRequest request) {
return base.Channel.wsvdealerinfo_XML(request);
}
public string wsvdealerinfo_XML(Dealerinfo.wsvDealerinfo.WSVDealerInfoInput inputData) {
Dealerinfo.wsvDealerinfo.wsvdealerinfo_XMLRequest inValue = new Dealerinfo.wsvDealerinfo.wsvdealerinfo_XMLRequest();
inValue.inputData = inputData;
Dealerinfo.wsvDealerinfo.wsvdealerinfo_XMLResponse retVal = ((Dealerinfo.wsvDealerinfo.WSVDealerInfoServices)(this)).wsvdealerinfo_XML(inValue);
return retVal.wsvdealerinfo_XMLReturn;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
Dealerinfo.wsvDealerinfo.wsvdealerinfoResponse Dealerinfo.wsvDealerinfo.WSVDealerInfoServices.wsvdealerinfo(Dealerinfo.wsvDealerinfo.wsvdealerinfoRequest request) {
return base.Channel.wsvdealerinfo(request);
}
public Dealerinfo.wsvDealerinfo.WSVDealerInfoResult wsvdealerinfo(Dealerinfo.wsvDealerinfo.WSVDealerInfoInput inputData) {
Dealerinfo.wsvDealerinfo.wsvdealerinfoRequest inValue = new Dealerinfo.wsvDealerinfo.wsvdealerinfoRequest();
inValue.inputData = inputData;
Dealerinfo.wsvDealerinfo.wsvdealerinfoResponse retVal = ((Dealerinfo.wsvDealerinfo.WSVDealerInfoServices)(this)).wsvdealerinfo(inValue);
return retVal.wsvdealerinfoReturn;
}
}
}

View File

@@ -0,0 +1,292 @@
2010-06-24 Atsushi Enomoto <atsushi@ximian.com>
* MetadataExchangeBindingsTest.cs : make sure that the target port
of the Uri is available (as some other tests do).
2010-06-17 Atsushi Enomoto <atsushi@ximian.com>
* MetadataExchangeBindingsTest.cs : make sure that special casing of
MessageVersion does not happen at this layer.
2010-04-05 Atsushi Enomoto <atsushi@ximian.com>
* WsdlExporterTest.cs : fixed and enabled some working tests.
2010-04-02 Atsushi Enomoto <atsushi@ximian.com>
* FaultDescriptionTest.cs : add new test.
2010-03-29 Atsushi Enomoto <atsushi@ximian.com>
* MetadataResolverTest.cs : enable working tests.
2010-03-17 Atsushi Enomoto <atsushi@ximian.com>
* MetadataExchangeBindingsTest.cs : new test.
2010-02-10 Atsushi Enomoto <atsushi@ximian.com>
* WsdlImporterTest.cs : ignore whatever make dist broke.
Until make dist gets fixed I won't enable any of new external-
source-dependent tests.
2010-02-09 Atsushi Enomoto <atsushi@ximian.com>
* WsdlImporterTest.cs : added test for processing ArrayOfXxx types.
2010-01-28 Atsushi Enomoto <atsushi@ximian.com>
* ServiceContractGeneratorTest.cs : add test for async method
generation option to generate sync methods as well.
2010-01-22 Atsushi Enomoto <atsushi@ximian.com>
* ServiceMetadataBehaviorTest.cs : check name constant (MSDN is
wrong here).
2010-01-19 Atsushi Enomoto <atsushi@ximian.com>
* ServiceAuthorizationBehaviorTest.cs : it's updated and enabled.
Added some more tests.
2010-01-06 Atsushi Enomoto <atsushi@ximian.com>
* ServiceDebugBehaviorTest.cs : make sure to close hosts.
2009-10-01 Atsushi Enomoto <atsushi@ximian.com>
* ServiceContractGeneratorTest.cs : new test.
2009-09-15 Atsushi Enomoto <atsushi@ximian.com>
* ServiceDebugBehaviorTest.cs : it still seems there are some port-
blocking tests that blocks here, so change the port and make sure
it is available. 8080 is anyways likely to interfere with others.
2009-07-31 Atsushi Enomoto <atsushi@ximian.com>
* ServiceEndpointTest.cs : new.
2009-07-02 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : make sure the contract actually
contains operations from the base types.
2009-07-02 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : added test for derived contract type.
2009-06-09 Atsushi Enomoto <atsushi@ximian.com>
* ServiceThrottlingBehaviorTest.cs : new.
2009-02-24 Atsushi Enomoto <atsushi@ximian.com>
* WsdlExporterTest.cs:
Ignore all failing-under-dotnet tests
2008-05-22 Roei Erez <roeie@mainsoft.com>
* fix ContractDescription.GetContract implementation
* Refactor Request processing
* Add support for message inspectors
* Add support for InstanceContextProvider & InstanceProvider, including lifecycles events
like: ReleaseServiceInstance, Open, Close...
* Add relevant test cases.
2008-05-01 Eyal Alaluf <eyala@mainsoft.com>
* ContractDescriptionTest.cs: Add test with method operation, parameters
and return value names specified by attributes.
2008-04-21 Igor Zelmanovich <igorz@mainsoft.com>
* ServiceDebugBehaviorTest.cs: new testfixture.
* ServiceMetadataBehaviorTest.cs: new testfixture.
2008-04-21 Igor Zelmanovich <igorz@mainsoft.com>
* WsdlExporterTest.cs: added new test.
2008-04-10 Eyal Alaluf <eyala@mainsoft.com>
* TypedMessageConverterTest.cs: Enabled and extended the roundtrip tests.
Used XML namespaces for the message data types.
2008-03-30 Atsushi Enomoto <atsushi@ximian.com>
* WsdlExporterTest.cs, WsdlImporterTest.cs,
ContractDescriptionTest.cs : marked coupled of tests as NotWorking.
2008-03-23 Vladimir Krasnov <vladimirk@mainsoft.com>
* OperationDescriptionTest.cs: added parts and namespace tests
2007-08-19 Atsushi Enomoto <atsushi@ximian.com>
* WsdlImporterTest.cs : fix tests under run-test-ondotnet with 3.5.
2007-08-19 Atsushi Enomoto <atsushi@ximian.com>
* WsdlImporterTest.cs : use one tab instead of " ".
2007-08-19 Atsushi Enomoto <atsushi@ximian.com>
* WsdlExporterTest.cs : oops, fix errors.
2007-08-19 Atsushi Enomoto <atsushi@ximian.com>
* WsdlImporterTest.cs WsdlExporterTest.cs : warning cleanup.
2007-03-26 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : added conceptual test case that shows
MessageBodyAttribute is not inferred.
2006-10-04 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : added test to reject async operation
whose name does not begin with "Begin".
2006-10-04 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : added test to reject duplicate
operation names.
2006-10-03 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : added some async contract tests.
2006-09-15 Atsushi Enomoto <atsushi@ximian.com>
* ClientCredentialsTest.cs : split default property value tests into
each individual peoperty test, and added some more.
2006-09-14 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsTest.cs : new test.
2006-09-08 Ankit Jain <jankit@novell.com>
* WsdlExporterTest.cs: Add more tests. Remove redundant ones.
2006-09-07 Ankit Jain <jankit@novell.com>
* WsdlExporterTest.cs (ExportContractInvalid1): Remove "NotWorking".
2006-09-07 Ankit Jain <jankit@novell.com>
* WsdlExporterTest.cs (ExportContractInvalid1): New.
2006-09-07 Ankit Jain <jankit@novell.com>
* WsdlExporterTest.cs: New. Incomplete.
2006-09-05 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : added ignorable test that treats
IRequestChannel as a service contract. We don't need that.
2006-07-28 Atsushi Enomoto <atsushi@ximian.com>
* ClientCredentialsTest.cs : new file.
2006-07-14 Atsushi Enomoto <atsushi@ximian.com>
* TypedMessageConverterTest.cs : Added StandardRoundtrip(), though
NotWorking.
2006-07-14 Atsushi Enomoto <atsushi@ximian.com>
* TypedMessageConverterTest.cs : added StandardToMessage().
2006-07-13 Ankit Jain <jankit@novell.com>
* WsdlImporterTest.cs: More June CTP updates.
* dump.xml: Regenerated for June CTP.
* MetadataResolverTest.cs: New.
2006-07-13 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs :
Added test for async pattern (IMetadataExchange).
2006-07-06 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs :
Added test for methods that takes and returns Message.
Added test for invalid async pattern.
2006-07-06 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs, TypedMessageConverterTest.cs :
June CTP fixes.
2006-07-05 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : [MessageBody] -> [MessageBodyMember].
2006-07-05 Atsushi Enomoto <atsushi@ximian.com>
* WsdlImporterTest.cs,
ContractDescriptionTest.cs : reflect June CTP updates.
2006-07-03 Ankit Jain <jankit@novell.com>
* WsdlImporterTest.cs: Update for June CTP changes.
2006-07-03 Ankit Jain <jankit@novell.com>
* WsdlImporterTest.cs: Use
DataContractSerializerMessageContractImporter instead of
DataContractSerializerMessageContractConverter.
2006-06-12 Ankit Jain <jankit@novell.com>
* WsdlImporterTest.cs : New.
* dump.xml: New. Required for WsdlImporterTest.cs
2006-05-29 Atsushi Enomoto <atsushi@ximian.com>
* TypedMessageConverterTest.cs : new test file.
2006-04-07 Atsushi Enomoto <atsushi@ximian.com>
* OperationDescriptionTest.cs : test MessageDescriptions as well.
2006-04-05 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : test to reject operation-less contract.
2006-04-05 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionTest.cs : moved from Test/S.SM.Dispatcher.
* OperationDescriptionTest.cs : new file.
2006-03-02 Atsushi Enomoto <atsushi@ximian.com>
(resumed changelogging)
* ChannelBuildContextTest.cs :
Added tests for null ListenUri arguments.
2006-02-23 Atsushi Enomoto <atsushi@ximian.com>
* ChannelBuildContextTest.cs : Feb. CTP API changes - chapter 1.
2006-01-26 Atsushi Enomoto <atsushi@ximian.com>
* ChannelBuildContextTest.cs : (ConsumeBindingElements)
Use BindingElements instead of non-implemented WSHttpBinding.
2005-11-20 Atsushi Enomoto <atsushi@ximian.com>
* ChannelBuildContext.cs : new file.
2005-10-26 Atsushi Enomoto <atsushi@ximian.com>
* TypeLoaderTest.cs : actually this is rather ContractDescription
test, so it is being moved.
2005-10-24 Atsushi Enomoto <atsushi@ximian.com>
* TypeLoaderTest.cs : new test.

View File

@@ -0,0 +1,115 @@
//
// ClientCredentialsTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.IdentityModel.Claims;
using System.IdentityModel.Selectors;
using System.Security.Principal;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Security;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ClientCredentialsTest
{
[Test]
public void ClientCertificate ()
{
ClientCredentials c = new ClientCredentials ();
Assert.AreEqual (true, c.SupportInteractive, "#1");
X509CertificateInitiatorClientCredential ccert =
c.ClientCertificate;
Assert.IsNull (ccert.Certificate, "#2");
}
[Test]
public void HttpDigest ()
{
ClientCredentials c = new ClientCredentials ();
// FIXME: implement
HttpDigestClientCredential http = c.HttpDigest;
}
[Test]
public void IssuedToken ()
{
ClientCredentials c = new ClientCredentials ();
IssuedTokenClientCredential iss = c.IssuedToken;
Assert.IsNotNull (iss, "#1");
Assert.AreEqual (true, iss.CacheIssuedTokens, "#2");
Assert.AreEqual (SecurityKeyEntropyMode.CombinedEntropy, iss.DefaultKeyEntropyMode, "#3");
Assert.AreEqual (60, iss.IssuedTokenRenewalThresholdPercentage, "#4");
Assert.AreEqual (0, iss.IssuerChannelBehaviors.Count, "#5");
Assert.IsNull (iss.LocalIssuerAddress, "#6");
Assert.IsNull (iss.LocalIssuerBinding, "#7");
Assert.AreEqual (0, iss.LocalIssuerChannelBehaviors.Count, "#8");
Assert.AreEqual (TimeSpan.MaxValue, iss.MaxIssuedTokenCachingTime, "#9");
}
[Test]
public void Peer ()
{
ClientCredentials c = new ClientCredentials ();
// FIXME: implement
PeerCredential peer = c.Peer;
}
[Test]
public void ServiceCertificate ()
{
ClientCredentials c = new ClientCredentials ();
// FIXME: implement
X509CertificateRecipientClientCredential scert =
c.ServiceCertificate;
}
[Test]
public void UserName ()
{
ClientCredentials c = new ClientCredentials ();
// FIXME: implement
UserNamePasswordClientCredential userpass = c.UserName;
}
[Test]
public void Windows ()
{
ClientCredentials c = new ClientCredentials ();
WindowsClientCredential win = c.Windows;
Assert.IsNotNull (win.ClientCredential, "#1");
Assert.IsTrue (win.AllowNtlm, "#2");
Assert.AreEqual (TokenImpersonationLevel.Identification, win.AllowedImpersonationLevel, "#3");
}
}
}

View File

@@ -0,0 +1,74 @@
//
// FaultDescriptionTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Net.Security;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class FaultDescriptionTest
{
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void NullAction ()
{
new FaultDescription (null);
}
[Test]
public void SimpleUse ()
{
var cd = ContractDescription.GetContract (typeof (ITestContract));
var od = cd.Operations [0];
Assert.AreEqual (1, od.Faults.Count, "#1");
var fd = od.Faults [0];
// automatically filled names
Assert.AreEqual ("http://tempuri.org/ITestContract/EchoMyDetailFault", fd.Action, "#2");
Assert.AreEqual ("MyDetailFault", fd.Name, "#3");
Assert.AreEqual ("http://tempuri.org/", fd.Namespace, "#4");
}
class MyDetail
{
}
[ServiceContract]
interface ITestContract
{
[OperationContract]
[FaultContract (typeof (MyDetail))]
string Echo (string input);
}
}
}

View File

@@ -0,0 +1,130 @@
//
// MetadataResolverTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class MetadataExchangeBindingsTest
{
Uri CreateUri (string uriString)
{
var uri = new Uri (uriString);
var l = new TcpListener (uri.Port);
l.Start ();
l.Stop ();
return uri;
}
[Test]
public void CreateMexHttpBinding ()
{
var b = MetadataExchangeBindings.CreateMexHttpBinding () as WSHttpBinding;
Assert.IsNotNull (b, "#1");
Assert.AreEqual (SecurityMode.None, b.Security.Mode, "#2");
Assert.IsFalse (b.TransactionFlow, "#3");
Assert.IsFalse (b.ReliableSession.Enabled, "#4");
Assert.IsFalse (b.CreateBindingElements ().Any (be => be is SecurityBindingElement), "#b1");
Assert.IsTrue (b.CreateBindingElements ().Any (be => be is TransactionFlowBindingElement), "#b2");
Assert.IsFalse (b.CreateBindingElements ().Any (be => be is ReliableSessionBindingElement), "#b3");
Assert.IsTrue (new TransactionFlowBindingElement ().TransactionProtocol == TransactionProtocol.Default, "#x1");
Assert.AreEqual (MessageVersion.Soap12WSAddressing10, b.MessageVersion, "#5");
Assert.AreEqual (MessageVersion.Soap12WSAddressing10, b.GetProperty<MessageVersion> (new BindingParameterCollection ()), "#6");
var host = new ServiceHost (typeof (MetadataExchange));
host.AddServiceEndpoint (typeof (IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding (), CreateUri ("http://localhost:8080"));
host.Open ();
try {
// it still does not rewrite MessageVersion.None. It's rather likely ServiceMetadataExtension which does overwriting.
Assert.AreEqual (MessageVersion.Soap12WSAddressing10, ((ChannelDispatcher) host.ChannelDispatchers [0]).MessageVersion, "#7");
} finally {
host.Close ();
}
}
[Test]
public void CreateMexHttpsBinding()
{
var b = MetadataExchangeBindings.CreateMexHttpsBinding() as WSHttpBinding;
Assert.IsNotNull(b, "#1");
Assert.AreEqual(SecurityMode.Transport, b.Security.Mode, "#2");
Assert.IsFalse(b.TransactionFlow, "#3");
Assert.IsFalse(b.ReliableSession.Enabled, "#4");
Assert.IsFalse(b.CreateBindingElements().Any(be => be is SecurityBindingElement), "#b1");
Assert.IsTrue(b.CreateBindingElements().Any(be => be is TransactionFlowBindingElement), "#b2");
Assert.IsFalse(b.CreateBindingElements().Any(be => be is ReliableSessionBindingElement), "#b3");
Assert.IsTrue(new TransactionFlowBindingElement().TransactionProtocol == TransactionProtocol.Default, "#x1");
Assert.AreEqual(MessageVersion.Soap12WSAddressing10, b.MessageVersion, "#5");
Assert.AreEqual(MessageVersion.Soap12WSAddressing10, b.GetProperty<MessageVersion>(new BindingParameterCollection()), "#6");
Assert.AreEqual(Uri.UriSchemeHttps, b.Scheme, "#8");
var host = new ServiceHost(typeof(MetadataExchange));
host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpsBinding(), CreateUri("https://localhost:8080"));
host.Open();
try
{
// it still does not rewrite MessageVersion.None. It's rather likely ServiceMetadataExtension which does overwriting.
Assert.AreEqual(MessageVersion.Soap12WSAddressing10, ((ChannelDispatcher)host.ChannelDispatchers[0]).MessageVersion, "#7");
}
finally
{
host.Close();
}
}
public class MetadataExchange : IMetadataExchange
{
public Message Get (Message request)
{
throw new Exception ();
}
public IAsyncResult BeginGet (Message request, AsyncCallback callback, object state)
{
throw new Exception ();
}
public Message EndGet (IAsyncResult result)
{
throw new Exception ();
}
}
}
}

View File

@@ -0,0 +1,373 @@
//
// MetadataResolverTest.cs
//
// Author:
// Ankit Jain <JAnkit@novell.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel.Description;
using System.ServiceModel;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class MetadataResolverTest
{
string url = "http://localhost:37564/echo/mex";
//string url = "http://192.168.0.1:8080/echo/mex";
static HttpListener listener;
IAsyncResult current_request;
int remaining;
static readonly string mex = File.ReadAllText ("Test/System.ServiceModel.Description/dump.xml");
[SetUp]
public void StartupServer ()
{
if (listener != null)
listener.Stop ();
listener = new HttpListener ();
listener.Prefixes.Add ("http://*:37564/echo/");
listener.Start ();
current_request = listener.BeginGetContext (OnReceivedRequest, null);
remaining = 1;
}
void OnReceivedRequest (IAsyncResult result)
{
try {
var ctx = listener.EndGetContext (result);
current_request = null;
ctx.Response.ContentType = "application/soap+xml";
ctx.Response.ContentLength64 = mex.Length;
using (var sw = new StreamWriter (ctx.Response.OutputStream))
sw.Write (mex);
ctx.Response.Close ();
if (--remaining > 0)
current_request = listener.BeginGetContext (OnReceivedRequest, null);
} catch (Exception ex) {
// ignore server errors in this test.
}
}
[TearDown]
public void ShutdownServer ()
{
listener.Stop ();
listener = null;
}
[Test]
[Category ("NotWorking")]
public void ResolveNoEndpoint ()
{
ServiceEndpointCollection endpoints = MetadataResolver.Resolve (
typeof (NonExistantContract),
new EndpointAddress (url));
Assert.IsNotNull (endpoints);
Assert.AreEqual (0, endpoints.Count);
}
[Test]
[Category ("NotWorking")]
public void Resolve1 ()
{
ServiceEndpointCollection endpoints = MetadataResolver.Resolve (
typeof (IEchoService), new EndpointAddress (url));
CheckIEchoServiceEndpoint (endpoints);
}
[Test]
[Category ("NotWorking")]
public void Resolve2 ()
{
ServiceEndpointCollection endpoints = MetadataResolver.Resolve (
typeof (IEchoService),
new Uri (url),
MetadataExchangeClientMode.MetadataExchange);
CheckIEchoServiceEndpoint (endpoints);
}
[Test]
[Category ("NotWorking")]
public void Resolve3 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
ServiceEndpointCollection endpoints = MetadataResolver.Resolve (
contracts,
new Uri (url),
MetadataExchangeClientMode.MetadataExchange);
CheckIEchoServiceEndpoint (endpoints);
}
[Test]
[Category ("NotWorking")]
public void Resolve4 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
contracts.Add (ContractDescription.GetContract (typeof (NonExistantContract)));
ServiceEndpointCollection endpoints = MetadataResolver.Resolve (
contracts,
new Uri (url),
MetadataExchangeClientMode.MetadataExchange);
CheckIEchoServiceEndpoint (endpoints);
}
[Test]
[Category ("NotWorking")]
public void Resolve5 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
contracts.Add (ContractDescription.GetContract (typeof (NonExistantContract)));
//FIXME: What is the 'client' param used for?
//TODO: Write test cases for the related overloads of Resolve
MetadataResolver.Resolve (
contracts,
new EndpointAddress (url),
new MetadataExchangeClient (new EndpointAddress ("http://localhost")));
}
[Test]
[Category ("NotWorking")]
public void Resolve6 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
contracts.Add (ContractDescription.GetContract (typeof (NonExistantContract)));
//FIXME: What is the 'client' param used for?
//TODO: Write test cases for the related overloads of Resolve
MetadataResolver.Resolve (
contracts,
new Uri (url),
MetadataExchangeClientMode.MetadataExchange,
new MetadataExchangeClient (new EndpointAddress ("http://localhost")));
}
//Negative tests
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ErrResolve1 ()
{
MetadataResolver.Resolve (
typeof (IEchoService),
null,
MetadataExchangeClientMode.MetadataExchange);
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Ignore ("does not fail on .NET either")]
public void ErrResolve2 ()
{
//Mex cannot be fetched with HttpGet from the given url
MetadataResolver.Resolve (
typeof (IEchoService),
new Uri (url),
MetadataExchangeClientMode.HttpGet);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ErrResolve3 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
contracts.Add (ContractDescription.GetContract (typeof (NonExistantContract)));
MetadataResolver.Resolve (contracts, new EndpointAddress (url),
(MetadataExchangeClient) null);
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ErrResolve4 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
contracts.Add (ContractDescription.GetContract (typeof (NonExistantContract)));
//FIXME: What is the 'client' param used for?
//TODO: Write test cases for the related overloads of Resolve
MetadataResolver.Resolve (
contracts,
new EndpointAddress ("http://localhost"),
new MetadataExchangeClient (new EndpointAddress (url)));
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Ignore ("does not fail on .NET either")]
public void ErrResolve5 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
contracts.Add (ContractDescription.GetContract (typeof (NonExistantContract)));
//FIXME: What is the 'client' param used for?
//TODO: Write test cases for the related overloads of Resolve
MetadataResolver.Resolve (
contracts,
new Uri (url),
MetadataExchangeClientMode.HttpGet,
new MetadataExchangeClient (new EndpointAddress ("http://localhost")));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ErrResolve6 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
//FIXME: What is the 'client' param used for?
//TODO: Write test cases for the related overloads of Resolve
MetadataResolver.Resolve (
contracts,
new Uri (url),
MetadataExchangeClientMode.HttpGet,
new MetadataExchangeClient (new EndpointAddress ("http://localhost")));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ErrResolve7 ()
{
MetadataResolver.Resolve (
null,
new Uri (url),
MetadataExchangeClientMode.HttpGet,
new MetadataExchangeClient (new EndpointAddress ("http://localhost")));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ErrResolve8 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
MetadataResolver.Resolve (contracts, null);
}
/* Test for bad endpoint address */
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ErrResolve9 ()
{
ContractDescription contract = ContractDescription.GetContract (typeof (IEchoService));
List<ContractDescription> contracts = new List<ContractDescription> ();
contracts.Add (contract);
MetadataResolver.Resolve (contracts, new EndpointAddress ("http://localhost"));
}
private void CheckIEchoServiceEndpoint (ServiceEndpointCollection endpoints)
{
Assert.IsNotNull (endpoints);
Assert.AreEqual (1, endpoints.Count);
ServiceEndpoint ep = endpoints [0];
//URI Dependent
//Assert.AreEqual ("http://localhost:8080/echo/svc", ep.Address.Uri.AbsoluteUri, "#R1");
Assert.AreEqual ("IEchoService", ep.Contract.Name, "#R3");
Assert.AreEqual ("http://myns/echo", ep.Contract.Namespace, "#R4");
Assert.AreEqual ("BasicHttpBinding_IEchoService", ep.Name, "#R5");
Assert.AreEqual (typeof (BasicHttpBinding), ep.Binding.GetType (), "#R2");
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ResolveNonContract ()
{
MetadataResolver.Resolve (
typeof (Int32), new EndpointAddress (url));
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ResolveBadUri ()
{
MetadataResolver.Resolve (
typeof (IEchoService), new EndpointAddress ("http://localhost"));
}
[DataContract]
public class dc
{
[DataMember]
string field;
}
[ServiceContract (Namespace = "http://myns/echo")]
public interface IEchoService
{
[OperationContract]
string Echo (string msg, int num, dc d);
[OperationContract]
string DoubleIt (int it, string prefix);
}
[ServiceContract]
public class NonExistantContract
{
}
}
}

View File

@@ -0,0 +1,62 @@
//
// MetadataSetTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2011 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class MetadataSetTest
{
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ReadFromNull ()
{
MetadataSet.ReadFrom (null);
}
[Test]
public void ReadFrom ()
{
XmlReader xr = XmlTextReader.Create ("Test/XmlFiles/one.xml");
var metadata = MetadataSet.ReadFrom (xr);
Assert.AreEqual (5, metadata.MetadataSections.Count, "#1");
Assert.AreEqual (2, metadata.MetadataSections.Where (m => m.Dialect == MetadataSection.ServiceDescriptionDialect).Count (), "#2");
Assert.AreEqual (3, metadata.MetadataSections.Where (m => m.Dialect == MetadataSection.XmlSchemaDialect).Count (), "#3");
}
}
}

View File

@@ -0,0 +1,162 @@
//
// OperationDescriptionTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class OperationDescriptionTest
{
[Test]
public void Messages ()
{
ContractDescription cd =
ContractDescription.GetContract (typeof (IFoo));
OperationDescription od = cd.Operations [0];
Assert.IsNull (od.Messages.Find ("Echo"), "#1");
MessageDescription md = od.Messages.Find ("http://tempuri.org/IFoo/Echo");
Assert.IsNotNull (md, "#2");
Assert.AreEqual ("http://tempuri.org/IFoo/Echo", md.Action, "#3");
Assert.AreEqual (MessageDirection.Input, md.Direction, "#4");
Assert.IsFalse (md.HasProtectionLevel, "#5");
Assert.IsNotNull (md.Headers, "#6");
Assert.AreEqual (0, md.Headers.Count, "#7");
Assert.IsNull (md.MessageType, "#8");
Assert.IsNotNull (md.Properties, "#9");
Assert.AreEqual (0, md.Properties.Count, "#10");
MessageBodyDescription mb = md.Body;
Assert.IsNotNull (mb, "#11");
Assert.AreEqual ("Echo", mb.WrapperName, "#12");
Assert.AreEqual ("http://tempuri.org/", mb.WrapperNamespace, "#13");
Assert.IsNotNull (mb.Parts, "#14");
Assert.AreEqual (0, mb.Parts.Count, "#15");
Assert.IsNull (mb.ReturnValue, "#16"); // void Echo()
}
[Test]
public void MessagesNameSpace ()
{
ContractDescription cd =
ContractDescription.GetContract (typeof (IFoo2));
OperationDescription od = cd.Operations [0];
Assert.IsNull (od.Messages.Find ("Echo"), "#1");
MessageDescription md = od.Messages.Find ("http://MonoTests.System.ServiceModel.Description/IFoo2/Echo");
Assert.IsNotNull (md, "#2");
Assert.AreEqual ("http://MonoTests.System.ServiceModel.Description/IFoo2/Echo", md.Action, "#3");
Assert.AreEqual (MessageDirection.Input, md.Direction, "#4");
Assert.IsFalse (md.HasProtectionLevel, "#5");
Assert.IsNotNull (md.Headers, "#6");
Assert.AreEqual (0, md.Headers.Count, "#7");
Assert.IsNull (md.MessageType, "#8");
Assert.IsNotNull (md.Properties, "#9");
Assert.AreEqual (0, md.Properties.Count, "#10");
MessageBodyDescription mb = md.Body;
Assert.IsNotNull (mb, "#11");
Assert.AreEqual ("Echo", mb.WrapperName, "#12");
Assert.AreEqual ("http://MonoTests.System.ServiceModel.Description", mb.WrapperNamespace, "#13");
Assert.IsNotNull (mb.Parts, "#14");
Assert.AreEqual (0, mb.Parts.Count, "#15");
Assert.IsNull (mb.ReturnValue, "#16"); // void Echo()
}
[Test]
public void Parts ()
{
ContractDescription cd =
ContractDescription.GetContract (typeof (IFoo3));
MessagePartDescriptionCollection parts =
cd.Operations [0].Messages [0].Body.Parts;
Assert.AreEqual (1, parts.Count, "#1");
MessagePartDescription part = parts [0];
Assert.AreEqual ("intValue", part.Name, "#2");
Assert.AreEqual ("http://tempuri.org/", part.Namespace, "#3");
Assert.AreEqual (typeof (int), part.Type, "#4");
Assert.AreEqual (0, part.Index, "#5");
Assert.AreEqual (false, part.Multiple, "#5");
}
[Test]
public void PartsNamespace ()
{
ContractDescription cd =
ContractDescription.GetContract (typeof (IFoo4));
MessagePartDescriptionCollection parts =
cd.Operations [0].Messages [0].Body.Parts;
Assert.AreEqual (1, parts.Count, "#1");
MessagePartDescription part = parts [0];
Assert.AreEqual ("intValue", part.Name, "#2");
Assert.AreEqual ("http://MonoTests.System.ServiceModel.Description", part.Namespace, "#3");
Assert.AreEqual (typeof (int), part.Type, "#4");
Assert.AreEqual (0, part.Index, "#5");
Assert.AreEqual (false, part.Multiple, "#5");
}
[ServiceContract]
public interface IFoo
{
[OperationContract]
void Echo ();
}
[ServiceContract(Namespace="http://MonoTests.System.ServiceModel.Description")]
public interface IFoo2
{
[OperationContract]
void Echo ();
}
[ServiceContract]
public interface IFoo3
{
[OperationContract]
int Echo (int intValue);
}
[ServiceContract (Namespace = "http://MonoTests.System.ServiceModel.Description")]
public interface IFoo4
{
[OperationContract]
int Echo (int intValue);
}
}
}

View File

@@ -0,0 +1,116 @@
//
// ServiceAuthorizationBehaviorTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ServiceAuthorizationBehaviorTest
{
[Test]
public void DefaultValues ()
{
var b = new ServiceAuthorizationBehavior ();
Assert.IsNull (b.ExternalAuthorizationPolicies, "#1-1");
Assert.IsFalse (b.ImpersonateCallerForAllOperations, "#1-2");
Assert.AreEqual (PrincipalPermissionMode.UseWindowsGroups, b.PrincipalPermissionMode, "#1-3");
ServiceHost host = new ServiceHost (typeof (TestService));
b = host.Description.Behaviors.Find<ServiceAuthorizationBehavior> ();
Assert.IsNull (b.ExternalAuthorizationPolicies, "#2-1");
Assert.IsFalse (b.ImpersonateCallerForAllOperations, "#2-2");
Assert.AreEqual (PrincipalPermissionMode.UseWindowsGroups, b.PrincipalPermissionMode, "#2-3");
}
[Test]
public void Validate ()
{
var b = new ServiceAuthorizationBehavior ();
IServiceBehavior sb = b;
sb.Validate (new ServiceDescription (),
new ServiceHost (typeof (object)));
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Category ("NotWorking")]
public void ImpersonateCallerWithNoValidOperation ()
{
ServiceHost host = new ServiceHost (typeof (TestService));
var b = host.Description.Behaviors.Find<ServiceAuthorizationBehavior> ();
b.ImpersonateCallerForAllOperations = true;
b.PrincipalPermissionMode = PrincipalPermissionMode.None;
host.AddServiceEndpoint (typeof (TestService), new BasicHttpBinding (), new Uri ("http://localhost:37564"));
host.Open ();
}
[Test]
public void ApplyBehavior ()
{
ServiceHost host = new ServiceHost (typeof (TestService2));
var b = host.Description.Behaviors.Find<ServiceAuthorizationBehavior> ();
b.ImpersonateCallerForAllOperations = false;
b.PrincipalPermissionMode = PrincipalPermissionMode.None;
host.AddServiceEndpoint (typeof (TestService2), new BasicHttpBinding (), new Uri ("http://localhost:37564"));
host.Open ();
var ed = ((ChannelDispatcher) host.ChannelDispatchers [0]).Endpoints [0];
var db = ed.DispatchRuntime;
host.Close ();
Assert.IsFalse (db.ImpersonateCallerForAllOperations, "#1");
Assert.AreEqual (PrincipalPermissionMode.None,
db.PrincipalPermissionMode, "#2");
}
[ServiceContract]
public class TestService
{
[OperationContract]
public void Foo () {}
}
[ServiceContract]
public class TestService2
{
[OperationContract]
[OperationBehavior (Impersonation = ImpersonationOption.Allowed)]
public void Foo () {}
}
}
}

View File

@@ -0,0 +1,121 @@
//
// ServiceContractGeneratorTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2009 Novell, Inc. http://novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.CodeDom;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
static class CollectionBaseEnumerable
{
public static T FirstOrDefault<T> (this CollectionBase coll, Func<T,bool> func)
{
foreach (T t in coll)
if (func (t))
return t;
return default (T);
}
public static int Count<T> (this CollectionBase coll, Func<T,bool> func)
{
int c = 0;
foreach (T t in coll)
if (func (t))
c++;
return c;
}
}
[TestFixture]
public class ServiceContractGeneratorTest
{
[Test]
public void GenerateServiceContractType ()
{
var g = new ServiceContractGenerator ();
g.GenerateServiceContractType (ContractDescription.GetContract (typeof (ITestService)));
var cns = g.TargetCompileUnit.Namespaces [0];
Assert.AreEqual (3, cns.Types.Count, "#1");
var iface = cns.Types.FirstOrDefault<CodeTypeDeclaration> (t => t.Name == "ITestService");
Assert.AreEqual (2, iface.Members.Count, "#2-0");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork"), "#2-1");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork2"), "#2-2");
var proxy = cns.Types.FirstOrDefault<CodeTypeDeclaration> (t => t.Name == "TestServiceClient");
Assert.AreEqual (7, proxy.Members.Count, "#3-0");
Assert.AreEqual (5, proxy.Members.Count<CodeTypeMember> (m => m.Name == ".ctor"), "#3-0-2");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork"), "#3-1");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork2"), "#3-2");
}
[Test]
public void AsynchronousMethods ()
{
var g = new ServiceContractGenerator ();
g.Options |= ServiceContractGenerationOptions.AsynchronousMethods;
g.GenerateServiceContractType (ContractDescription.GetContract (typeof (ITestService)));
var cns = g.TargetCompileUnit.Namespaces [0];
Assert.AreEqual (3, cns.Types.Count, "#1");
var iface = cns.Types.FirstOrDefault<CodeTypeDeclaration> (t => t.Name == "ITestService");
Assert.AreEqual (6, iface.Members.Count, "#2-0");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork"), "#2-1");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork2"), "#2-2");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "BeginDoWork"), "#2-3");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "BeginDoWork2"), "#2-4");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "EndDoWork"), "#2-5");
Assert.IsNotNull (iface.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "EndDoWork2"), "#2-6");
var proxy = cns.Types.FirstOrDefault<CodeTypeDeclaration> (t => t.Name == "TestServiceClient");
Assert.AreEqual (11, proxy.Members.Count, "#3-0");
Assert.AreEqual (5, proxy.Members.Count<CodeTypeMember> (m => m.Name == ".ctor"), "#3-0-2");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork"), "#3-1");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "DoWork2"), "#3-2");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "BeginDoWork"), "#3-3");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "BeginDoWork2"), "#3-4");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "EndDoWork"), "#3-5");
Assert.IsNotNull (proxy.Members.FirstOrDefault<CodeTypeMember> (m => m.Name == "EndDoWork2"), "#3-6");
}
[ServiceContract]
public interface ITestService
{
[OperationContract]
void DoWork (string s);
[OperationContract]
string DoWork2 (string s1, string s2);
}
}
}

View File

@@ -0,0 +1,136 @@
//
// ServiceCredentialsTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.IdentityModel.Claims;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
using System.Security.Cryptography.X509Certificates;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Security;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ServiceCredentialsTest
{
[Test]
public void ClientCertificate ()
{
X509CertificateInitiatorServiceCredential cc =
new ServiceCredentials ().ClientCertificate;
Assert.IsNull (cc.Certificate, "#1");
Assert.AreEqual (X509CertificateValidationMode.ChainTrust, cc.Authentication.CertificateValidationMode, "#2-1");
Assert.IsNull (cc.Authentication.CustomCertificateValidator, "#2-2");
Assert.IsTrue (cc.Authentication.IncludeWindowsGroups, "#2-3");
Assert.IsFalse (cc.Authentication.MapClientCertificateToWindowsAccount, "#2-4");
Assert.AreEqual (X509RevocationMode.Online, cc.Authentication.RevocationMode, "#2-5");
Assert.AreEqual (StoreLocation.LocalMachine, cc.Authentication.TrustedStoreLocation, "#2-6");
}
[Test]
public void IssuedTokenAuthentication ()
{
IssuedTokenServiceCredential ic =
new ServiceCredentials ().IssuedTokenAuthentication;
Assert.IsFalse (ic.AllowUntrustedRsaIssuers, "#1");
Assert.AreEqual (X509CertificateValidationMode.ChainTrust, ic.CertificateValidationMode, "#2");
Assert.IsNull (ic.CustomCertificateValidator, "#3");
Assert.AreEqual (0, ic.KnownCertificates.Count, "#4");
Assert.AreEqual (X509RevocationMode.Online, ic.RevocationMode, "#5");
Assert.IsNull (ic.SamlSerializer, "#6");
Assert.AreEqual (StoreLocation.LocalMachine, ic.TrustedStoreLocation, "#7");
}
[Test]
public void Peer ()
{
PeerCredential p = new ServiceCredentials ().Peer;
Assert.IsNull (p.Certificate, "#1");
Assert.IsNull (p.MeshPassword, "#2");
X509PeerCertificateAuthentication pa = p.MessageSenderAuthentication;
Assert.AreEqual (X509CertificateValidationMode.PeerOrChainTrust, pa.CertificateValidationMode, "#3-1");
Assert.IsNull (pa.CustomCertificateValidator, "#3-2");
Assert.AreEqual (X509RevocationMode.Online, pa.RevocationMode, "#3-3");
Assert.AreEqual (StoreLocation.CurrentUser, pa.TrustedStoreLocation, "#3-4");
pa = p.PeerAuthentication;
Assert.AreEqual (X509CertificateValidationMode.PeerOrChainTrust, pa.CertificateValidationMode, "#4-1");
Assert.IsNull (pa.CustomCertificateValidator, "#4-2");
Assert.AreEqual (X509RevocationMode.Online, pa.RevocationMode, "#4-3");
Assert.AreEqual (StoreLocation.CurrentUser, pa.TrustedStoreLocation, "#4-4");
}
[Test]
public void SecureConversationAuthentication ()
{
SecureConversationServiceCredential sc =
new ServiceCredentials ().SecureConversationAuthentication;
Assert.AreEqual (5, sc.SecurityContextClaimTypes.Count, "#1");
Collection<Type> types = new Collection<Type> (new Type [] {
typeof (SamlAuthorizationDecisionClaimResource),
typeof (SamlAuthenticationClaimResource),
typeof (SamlAccessDecision),
typeof (SamlAuthorityBinding),
typeof (SamlNameIdentifierClaimResource)});
foreach (Type type in sc.SecurityContextClaimTypes)
if (!types.Contains (type))
Assert.Fail (type.ToString ());
DataProtectionSecurityStateEncoder sse = sc.SecurityStateEncoder
as DataProtectionSecurityStateEncoder;
Assert.IsNotNull (sse, "#2-1");
Assert.IsTrue (sse.UseCurrentUserProtectionScope, "#2-2");
}
[Test]
public void ServiceCertificate ()
{
Assert.IsNull (new ServiceCredentials ().ServiceCertificate.Certificate, "#1");
}
[Test]
public void UserNameAuthentication ()
{
UserNamePasswordServiceCredential un =
new ServiceCredentials ().UserNameAuthentication;
Assert.AreEqual (TimeSpan.FromMinutes (15), un.CachedLogonTokenLifetime, "#1");
Assert.IsFalse (un.CacheLogonTokens, "#2");
Assert.IsNull (un.CustomUserNamePasswordValidator, "#3");
Assert.IsTrue (un.IncludeWindowsGroups, "#4");
Assert.AreEqual (0x80, un.MaxCachedLogonTokens, "#5");
Assert.IsNull (un.MembershipProvider, "#6");
Assert.AreEqual (UserNamePasswordValidationMode.Windows, un.UserNamePasswordValidationMode, "#7");
// TODO: WindowsAuthentication if we have infinite amount of free time.
}
}
}

View File

@@ -0,0 +1,234 @@
//
// ServiceDebugBehaviorTest.cs
//
// Author:
// Igor Zelmanovich <igorz@mainsoft.com>
//
// Copyright (C) 2008 Mainsoft, Inc. http://www.mainsoft.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Text;
using NUnit.Framework;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ServiceDebugBehaviorTest
{
[ServiceContract]
interface IMyContract
{
[OperationContract]
string GetData ();
}
class MyService : IMyContract
{
public string GetData () {
return "Hello World";
}
}
Uri CreateUri (string uriString)
{
var uri = new Uri (uriString);
var l = new TcpListener (uri.Port);
l.Start ();
l.Stop ();
return uri;
}
[Test]
public void InitializeRuntime1 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "e1");
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
try {
host.Open ();
Assert.AreEqual (2, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
ChannelDispatcher cd = (ChannelDispatcher) host.ChannelDispatchers [1];
Assert.AreEqual (1, cd.Endpoints.Count, "Endpoints.Count");
Assert.AreEqual ("ServiceMetadataBehaviorHttpGetBinding", cd.BindingName, "BindingName");
Assert.AreEqual (host, cd.Host, "Host");
//Assert.AreEqual (false, cd.IsTransactedAccept, "IsTransactedAccept");
//Assert.AreEqual (false, cd.IsTransactedReceive, "IsTransactedReceive");
EndpointDispatcher ed = cd.Endpoints [0];
Assert.AreEqual (typeof (EndpointAddressMessageFilter), ed.AddressFilter.GetType (), "AddressFilter");
Assert.AreEqual (cd, ed.ChannelDispatcher, "ChannelDispatcher");
Assert.AreEqual (typeof (MatchAllMessageFilter), ed.ContractFilter.GetType (), "ContractFilter");
Assert.AreEqual ("IHttpGetHelpPageAndMetadataContract", ed.ContractName, "ContractName");
Assert.AreEqual ("http://schemas.microsoft.com/2006/04/http/metadata", ed.ContractNamespace, "ContractNamespace");
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority");
EndpointAddress ea = ed.EndpointAddress;
// TODO
DispatchRuntime dr = ed.DispatchRuntime;
// TODO
} finally {
host.Close ();
}
}
}
[Test]
public void InitializeRuntime2 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
try {
host.Open ();
Assert.AreEqual (1, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
} finally {
host.Close ();
}
}
}
[Test]
public void InitializeRuntime3 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageEnabled = false;
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
try {
host.Open ();
Assert.AreEqual (1, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
} finally {
host.Close ();
}
}
}
[Test]
public void InitializeRuntime4 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:37564/help");
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
try {
host.Open ();
Assert.AreEqual (2, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
ChannelDispatcher cd = (ChannelDispatcher) host.ChannelDispatchers [1];
Assert.AreEqual (1, cd.Endpoints.Count, "Endpoints.Count");
Assert.AreEqual ("ServiceMetadataBehaviorHttpGetBinding", cd.BindingName, "BindingName");
Assert.AreEqual (host, cd.Host, "Host");
//Assert.AreEqual (false, cd.IsTransactedAccept, "IsTransactedAccept");
//Assert.AreEqual (false, cd.IsTransactedReceive, "IsTransactedReceive");
Assert.AreEqual (MessageVersion.None, cd.MessageVersion, "MessageVersion");
EndpointDispatcher ed = cd.Endpoints [0];
Assert.AreEqual (typeof (EndpointAddressMessageFilter), ed.AddressFilter.GetType (), "AddressFilter");
Assert.AreEqual (cd, ed.ChannelDispatcher, "ChannelDispatcher");
Assert.AreEqual (typeof (MatchAllMessageFilter), ed.ContractFilter.GetType (), "ContractFilter");
Assert.AreEqual ("IHttpGetHelpPageAndMetadataContract", ed.ContractName, "ContractName");
Assert.AreEqual ("http://schemas.microsoft.com/2006/04/http/metadata", ed.ContractNamespace, "ContractNamespace");
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority");
EndpointAddress ea = ed.EndpointAddress;
Assert.AreEqual (new Uri ("http://localhost:37564/help"), ea.Uri, "Uri");
DispatchRuntime dr = ed.DispatchRuntime;
Assert.AreEqual (1, dr.Operations.Count, "Operations.Count");
DispatchOperation dispOp = dr.Operations [0];
Assert.AreEqual ("*", dispOp.Action, "Operation.Action");
Assert.AreEqual ("*", dispOp.ReplyAction, "Operation.ReplyAction");
Assert.AreEqual ("Get", dispOp.Name, "Operation.Name");
//Assert.IsNotNull (dispOp.Invoker, "Operation.Invoker");
} finally {
host.Close ();
}
}
}
[Test]
public void ServiceMetadataExtension1 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:37564/help");
try {
host.Open ();
Assert.IsNotNull (host.Extensions.Find<ServiceMetadataExtension> (), "ServiceMetadataExtension #1");
Assert.AreEqual (1, host.Extensions.FindAll<ServiceMetadataExtension> ().Count, "ServiceMetadataExtension #2");
} finally {
host.Close ();
}
}
}
[Test]
public void ServiceMetadataExtension2 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = CreateUri ("http://localhost:37564/help");
ServiceMetadataExtension extension = new ServiceMetadataExtension ();
host.Extensions.Add (extension);
try {
host.Open ();
Assert.IsNotNull (host.Extensions.Find<ServiceMetadataExtension> (), "ServiceMetadataExtension #1");
Assert.AreEqual (1, host.Extensions.FindAll<ServiceMetadataExtension> ().Count, "ServiceMetadataExtension #2");
Assert.AreEqual (extension, host.Extensions.Find<ServiceMetadataExtension> (), "ServiceMetadataExtension #3");
} finally {
host.Close ();
}
}
}
[Test]
public void Defaults () {
ServiceDebugBehavior behavior = new ServiceDebugBehavior ();
Assert.AreEqual (true, behavior.HttpHelpPageEnabled, "HttpHelpPageEnabled");
Assert.IsNull (behavior.HttpHelpPageUrl, "HttpHelpPageUrl");
Assert.AreEqual (true, behavior.HttpsHelpPageEnabled, "HttpsHelpPageEnabled");
Assert.IsNull (behavior.HttpsHelpPageUrl, "HttpsHelpPageUrl");
Assert.AreEqual (false, behavior.IncludeExceptionDetailInFaults, "IncludeExceptionDetailInFaults");
}
}
}

View File

@@ -0,0 +1,77 @@
//
// ServiceEndpointTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2009 Novell, Inc. http://novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ServiceEndpointTest
{
static ContractDescription contract1 = ContractDescription.GetContract (typeof (Foo));
[Test]
public void NullArguments ()
{
new ServiceEndpoint (contract1, null, null);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void NullArguments2 ()
{
new ServiceEndpoint (null, null, null);
}
[Test]
public void ListenUri ()
{
Uri uri = new Uri ("http://localhost:37564");
var se = new ServiceEndpoint (contract1, null, new EndpointAddress (uri));
Assert.AreEqual (uri, se.ListenUri, "#1");
}
#region contracts
[ServiceContract]
interface Foo
{
[OperationContract]
string Echo (string input);
}
#endregion
}
}

View File

@@ -0,0 +1,272 @@
//
// ServiceMetadataBehaviorTest.cs
//
// Author:
// Igor Zelmanovich <igorz@mainsoft.com>
//
// Copyright (C) 2008 Mainsoft, Inc. http://www.mainsoft.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ServiceMetadataBehaviorTest
{
[ServiceContract]
interface IMyContract
{
[OperationContract]
string GetData ();
}
class MyService : IMyContract
{
public string GetData () {
return "Hello World";
}
}
[Test]
public void InitializeRuntime1 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:8080"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "e1");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true });
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
host.Open ();
Assert.AreEqual (2, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
ChannelDispatcher cd = (ChannelDispatcher) host.ChannelDispatchers [1];
Assert.AreEqual (1, cd.Endpoints.Count, "Endpoints.Count");
Assert.AreEqual ("ServiceMetadataBehaviorHttpGetBinding", cd.BindingName, "BindingName");
Assert.AreEqual (host, cd.Host, "Host");
//Assert.AreEqual (false, cd.IsTransactedAccept, "IsTransactedAccept");
//Assert.AreEqual (false, cd.IsTransactedReceive, "IsTransactedReceive");
EndpointDispatcher ed = cd.Endpoints [0];
Assert.AreEqual (typeof (EndpointAddressMessageFilter), ed.AddressFilter.GetType (), "AddressFilter");
Assert.AreEqual (cd, ed.ChannelDispatcher, "ChannelDispatcher");
Assert.AreEqual (typeof (MatchAllMessageFilter), ed.ContractFilter.GetType (), "ContractFilter");
Assert.AreEqual ("IHttpGetHelpPageAndMetadataContract", ed.ContractName, "ContractName");
Assert.AreEqual ("http://schemas.microsoft.com/2006/04/http/metadata", ed.ContractNamespace, "ContractNamespace");
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority");
EndpointAddress ea = ed.EndpointAddress;
// TODO
DispatchRuntime dr = ed.DispatchRuntime;
// TODO
host.Close ();
}
}
[Test]
public void InitializeRuntime2 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:8080"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:8080/mex_and_help") });
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:8080/mex_and_help");
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
host.Open ();
Assert.AreEqual (2, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
ChannelDispatcher cd = (ChannelDispatcher) host.ChannelDispatchers [1];
Assert.AreEqual (1, cd.Endpoints.Count, "Endpoints.Count");
Assert.AreEqual ("ServiceMetadataBehaviorHttpGetBinding", cd.BindingName, "BindingName");
Assert.AreEqual (host, cd.Host, "Host");
//Assert.AreEqual (false, cd.IsTransactedAccept, "IsTransactedAccept");
//Assert.AreEqual (false, cd.IsTransactedReceive, "IsTransactedReceive");
EndpointDispatcher ed = cd.Endpoints [0];
Assert.AreEqual (typeof (EndpointAddressMessageFilter), ed.AddressFilter.GetType (), "AddressFilter");
Assert.AreEqual (cd, ed.ChannelDispatcher, "ChannelDispatcher");
Assert.AreEqual (typeof (MatchAllMessageFilter), ed.ContractFilter.GetType (), "ContractFilter");
Assert.AreEqual ("IHttpGetHelpPageAndMetadataContract", ed.ContractName, "ContractName");
Assert.AreEqual ("http://schemas.microsoft.com/2006/04/http/metadata", ed.ContractNamespace, "ContractNamespace");
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority");
host.Close ();
}
}
[Test]
public void InitializeRuntime3 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:8080"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:8080/mex") });
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:8080/help");
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
host.Open ();
Assert.AreEqual (3, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
ChannelDispatcher cd = (ChannelDispatcher) host.ChannelDispatchers [1];
Assert.AreEqual (1, cd.Endpoints.Count, "Endpoints.Count");
EndpointDispatcher ed = cd.Endpoints [0];
Assert.AreEqual (typeof (EndpointAddressMessageFilter), ed.AddressFilter.GetType (), "AddressFilter #1");
Assert.AreEqual (cd, ed.ChannelDispatcher, "ChannelDispatcher #1");
Assert.AreEqual (typeof (MatchAllMessageFilter), ed.ContractFilter.GetType (), "ContractFilter #1");
Assert.AreEqual ("IHttpGetHelpPageAndMetadataContract", ed.ContractName, "ContractName #1");
Assert.AreEqual ("http://schemas.microsoft.com/2006/04/http/metadata", ed.ContractNamespace, "ContractNamespace #1");
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority #1");
EndpointAddress ea = ed.EndpointAddress;
// TODO
DispatchRuntime dr = ed.DispatchRuntime;
// TODO
cd = (ChannelDispatcher) host.ChannelDispatchers [2];
Assert.AreEqual (1, cd.Endpoints.Count, "Endpoints.Count");
ed = cd.Endpoints [0];
Assert.AreEqual (typeof (EndpointAddressMessageFilter), ed.AddressFilter.GetType (), "AddressFilter #2");
Assert.AreEqual (cd, ed.ChannelDispatcher, "ChannelDispatcher #2");
Assert.AreEqual (typeof (MatchAllMessageFilter), ed.ContractFilter.GetType (), "ContractFilter #2");
Assert.AreEqual ("IHttpGetHelpPageAndMetadataContract", ed.ContractName, "ContractName #2");
Assert.AreEqual ("http://schemas.microsoft.com/2006/04/http/metadata", ed.ContractNamespace, "ContractNamespace #2");
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority #2");
ea = ed.EndpointAddress;
// TODO
dr = ed.DispatchRuntime;
// TODO
host.Close ();
}
}
[Test]
public void InitializeRuntime4 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:8080"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:8080/mex") });
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
host.Open ();
Assert.AreEqual (2, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #2");
ChannelDispatcher cd = (ChannelDispatcher) host.ChannelDispatchers [1];
Assert.AreEqual (1, cd.Endpoints.Count, "Endpoints.Count");
Assert.AreEqual ("ServiceMetadataBehaviorHttpGetBinding", cd.BindingName, "BindingName");
Assert.AreEqual (host, cd.Host, "Host");
//Assert.AreEqual (false, cd.IsTransactedAccept, "IsTransactedAccept");
//Assert.AreEqual (false, cd.IsTransactedReceive, "IsTransactedReceive");
Assert.AreEqual (MessageVersion.None, cd.MessageVersion, "MessageVersion");
EndpointDispatcher ed = cd.Endpoints [0];
Assert.AreEqual (typeof (EndpointAddressMessageFilter), ed.AddressFilter.GetType (), "AddressFilter");
Assert.AreEqual (cd, ed.ChannelDispatcher, "ChannelDispatcher");
Assert.AreEqual (typeof (MatchAllMessageFilter), ed.ContractFilter.GetType (), "ContractFilter");
Assert.AreEqual ("IHttpGetHelpPageAndMetadataContract", ed.ContractName, "ContractName");
Assert.AreEqual ("http://schemas.microsoft.com/2006/04/http/metadata", ed.ContractNamespace, "ContractNamespace");
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority");
EndpointAddress ea = ed.EndpointAddress;
Assert.AreEqual (new Uri ("http://localhost:8080/mex"), ea.Uri, "Uri");
DispatchRuntime dr = ed.DispatchRuntime;
Assert.AreEqual (1, dr.Operations.Count, "Operations.Count");
DispatchOperation dispOp = dr.Operations [0];
Assert.AreEqual ("*", dispOp.Action, "Operation.Action");
Assert.AreEqual ("*", dispOp.ReplyAction, "Operation.ReplyAction");
Assert.AreEqual ("Get", dispOp.Name, "Operation.Name");
//Assert.IsNotNull (dispOp.Invoker, "Operation.Invoker");
host.Close ();
}
}
[Test]
public void ServiceMetadataExtension1 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:8080"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:8080/mex") });
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
host.Open ();
Assert.IsNotNull (host.Extensions.Find<ServiceMetadataExtension> (), "ServiceMetadataExtension #1");
Assert.AreEqual (1, host.Extensions.FindAll<ServiceMetadataExtension> ().Count, "ServiceMetadataExtension #2");
host.Close ();
}
}
[Test]
public void ServiceMetadataExtension2 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:8080"))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:8080/mex") });
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
ServiceMetadataExtension extension = new ServiceMetadataExtension ();
host.Extensions.Add (extension);
host.Open ();
Assert.IsNotNull (host.Extensions.Find<ServiceMetadataExtension> (), "ServiceMetadataExtension #1");
Assert.AreEqual (1, host.Extensions.FindAll<ServiceMetadataExtension> ().Count, "ServiceMetadataExtension #2");
Assert.AreEqual (extension, host.Extensions.Find<ServiceMetadataExtension> (), "ServiceMetadataExtension #3");
host.Close ();
}
}
[Test]
public void Defaults () {
ServiceMetadataBehavior behavior = new ServiceMetadataBehavior ();
Assert.IsNull (behavior.ExternalMetadataLocation, "ExternalMetadataLocation");
Assert.AreEqual (false, behavior.HttpGetEnabled, "HttpGetEnabled");
Assert.IsNull (behavior.HttpGetUrl, "HttpGetUrl");
Assert.AreEqual (false, behavior.HttpsGetEnabled, "HttpsGetEnabled");
Assert.IsNull (behavior.HttpsGetUrl, "HttpsGetUrl");
Assert.IsNotNull (behavior.MetadataExporter, "MetadataExporter #1");
Assert.AreEqual (typeof (WsdlExporter), behavior.MetadataExporter.GetType (), "MetadataExporter #2");
Assert.AreEqual ("IMetadataExchange", ServiceMetadataBehavior.MexContractName, "MexContractName");
}
}
}

View File

@@ -0,0 +1,57 @@
//
// ServiceEndpointTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2009 Novell, Inc. http://novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ServiceMetadataEndpointTest
{
[Test]
public void DefaultValues ()
{
var se = new ServiceMetadataEndpoint ();
Assert.IsNotNull (se.Contract, "#1");
Assert.AreEqual (typeof (IMetadataExchange), se.Contract.ContractType, "#1.2");
Assert.IsNotNull (se.Binding, "#2");
// FIXME: enable once we get usable WSHttpBinding.
// Assert.AreEqual (typeof (WSHttpBinding), se.Binding.GetType (), "#2.2");
Assert.IsNull (se.Address, "#3");
}
}
}
#endif

View File

@@ -0,0 +1,59 @@
//
// ServiceThrottlingBehaviorTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2009 Novell, Inc. http://novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class ServiceThrottlingBehaviorTest
{
[Test]
public void DefaultValues ()
{
var t = new ServiceThrottlingBehavior ();
Assert.AreEqual (10, t.MaxConcurrentSessions, "#1");
Assert.AreEqual (16, t.MaxConcurrentCalls, "#2");
Assert.AreEqual (26, t.MaxConcurrentInstances, "#3");
}
[Test]
[ExpectedException (typeof (InvalidOperationException))] // hmm...
public void SetZero ()
{
new ServiceThrottlingBehavior () { MaxConcurrentCalls = 0 };
}
}
}

View File

@@ -0,0 +1,222 @@
//
// TypedMessageConverterTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Description
{
[TestFixture]
public class TypedMessageConverterTest
{
[Test]
[ExpectedException (typeof (ArgumentException))]
public void InvalidArgumentType ()
{
TypedMessageConverter.Create (
typeof (int), "http://tempuri.org/MyTest");
}
[Test]
// It is imported from samples/typed-message-converter.
public void StandardToMessage ()
{
TypedMessageConverter c = TypedMessageConverter.Create (
typeof (Test1), "http://tempuri.org/MyTest");
Message msg = c.ToMessage (new Test1 ());
XmlDocument doc = new XmlDocument ();
doc.LoadXml (msg.ToString ());
XmlNamespaceManager nss = new XmlNamespaceManager (doc.NameTable);
nss.AddNamespace ("s", "http://www.w3.org/2003/05/soap-envelope");
nss.AddNamespace ("t", "http://tempuri.org/");
nss.AddNamespace ("v", "space");
nss.AddNamespace ("w", "yy1");
XmlElement el = doc.SelectSingleNode ("/s:Envelope/s:Body/v:MyName", nss) as XmlElement;
Assert.IsNotNull (el, "#1");
XmlNode part = el.SelectSingleNode ("t:body2", nss);
Assert.IsNotNull (part, "#2");
Assert.AreEqual ("TEST body", part.InnerText, "#3");
Assert.IsNotNull (el.SelectSingleNode ("w:xx1", nss), "#4");
part = el.SelectSingleNode ("w:xx1/v:msg", nss);
Assert.IsNotNull (part, "#5");
Assert.AreEqual ("default", part.InnerText, "#6");
}
[Test]
public void StandardRoundtrip ()
{
TypedMessageConverter c = TypedMessageConverter.Create (
typeof (Test1), "http://tempuri.org/MyTest");
Test1 t1 = new Test1 ();
t1.echo.msg = "test";
t1.body2 = "testtest";
Message msg = c.ToMessage (t1);
Test1 t2 = (Test1) c.FromMessage (msg);
Assert.AreEqual ("test", t2.echo.msg, "#01");
Assert.AreEqual ("testtest", t2.body2, "#02");
}
[Test]
public void StandardRoundtrip2 ()
{
TypedMessageConverter c = TypedMessageConverter.Create (
typeof (Test2), "http://tempuri.org/MyTest");
var t1 = new Test2 ();
t1.Body = new Echo () { msg = "test" };
var uid = Guid.NewGuid ();
t1.Id = uid;
Message msg = c.ToMessage (t1);
var t2 = (Test2) c.FromMessage (msg);
Assert.AreEqual ("test", t2.Body.msg, "#01");
Assert.AreEqual (uid, t2.Id, "#02");
}
[Test]
public void XmlSerializerdRoundtrip ()
{
TypedMessageConverter c = TypedMessageConverter.Create (
typeof (Test1), "http://tempuri.org/MyTest", new XmlSerializerFormatAttribute ());
Test1 t1 = new Test1 ();
t1.echo.msg = "test";
t1.body2 = "testtest";
Message msg = c.ToMessage (t1);
Test1 t2 = (Test1) c.FromMessage (msg);
Assert.AreEqual ("test", t2.echo.msg, "#01");
Assert.AreEqual ("testtest", t2.body2, "#02");
}
[Test]
public void XmlSerializerdWithXmlAttribute()
{
TypedMessageConverter c = TypedMessageConverter.Create (
typeof (Test3), "http://tempuri.org/MyTest",
new XmlSerializerFormatAttribute ());
string xmlMessage = @"<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope'
xmlns:a='http://www.w3.org/2005/08/addressing'>
<s:Header><a:Action s:mustUnderstand='1'>http://tempuri.org/MyTest</a:Action></s:Header>
<s:Body xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<test xmlns='urn:foo'>
<Id>OneID</Id>
<Element>
<Prop1 xmlns='urn:bar'>foo</Prop1>
<Prop2 xmlns='urn:bar'>2</Prop2>
</Element>
<Element>
<Prop1 xmlns='urn:bar'>bar</Prop1>
<Prop2 xmlns='urn:bar'>3</Prop2>
</Element>
</test>
</s:Body>
</s:Envelope>";
byte[] buffer = Encoding.UTF8.GetBytes(xmlMessage);
using (XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(buffer, XmlDictionaryReaderQuotas.Max))
{
Message messagedisk = Message.CreateMessage(reader, int.MaxValue, MessageVersion.Soap12);
Test3 obj = c.FromMessage(messagedisk) as Test3;
Assert.IsNotNull(obj);
Assert.AreEqual("OneID", obj.Id);
Assert.IsNotNull(obj.ArrayOfElement);
Assert.AreEqual(2, obj.ArrayOfElement.Length);
Assert.AreEqual("foo", obj.ArrayOfElement[0].Prop1);
Assert.AreEqual(3, obj.ArrayOfElement[1].Prop2);
}
}
}
[MessageContract (WrapperNamespace = "space", WrapperName = "MyName")]
public class Test1
{
[MessageBodyMember (Name = "xx1", Namespace = "yy1")]
public Echo echo = new Echo ();
[MessageBodyMember]
public string body2 = "TEST body";
}
[DataContract (Namespace = "space")]
public class Echo
{
[DataMember]
public string msg = "default";
}
[MessageContract (IsWrapped = false)]
public class Test2
{
[MessageHeader (Name = "head", Namespace = "urn:foo")]
public Guid Id { get; set; }
[MessageBodyMember (Name = "body", Namespace = "urn:foo")]
public Echo Body { get; set; }
}
[MessageContract(WrapperName = "test",
WrapperNamespace = "urn:foo",
IsWrapped = true)]
public class Test3
{
[MessageBodyMember()]
[XmlElementAttribute()]
public string Id;
[MessageBodyMember()]
[XmlElement(Type = typeof(ElementType), ElementName = "Element")]
public ElementType[] ArrayOfElement;
}
[Serializable]
[XmlType(Namespace = "urn:bar")]
public class ElementType
{
[XmlElement(Order = 0)]
public string Prop1 { get; set; }
[XmlElement(Order = 1)]
public int Prop2 { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More