From 0d4c1edfca8a220370eaab927c6ebca9b204de8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20M=C3=B6rner?= Date: Mon, 11 Mar 2024 11:09:44 +0100 Subject: [PATCH] remove obsolete stuff (MessageInspector and overload of AddMessageFilter) --- .../ClientMessageInspector.cs | 34 ---- .../CustomHeadersEndpointBehavior.cs | 36 ----- .../MessageInspector/MessageInspectorMock.cs | 91 ----------- .../MessageInspector/MessageInspectorTests.cs | 149 ------------------ .../MessageInspector/Startup.cs | 40 ----- .../MessageInspectors/InspectorStyle.cs | 8 - .../MessageInspector/MessageInspectorMock.cs | 43 ----- .../MessageInspector/MessageInspectorTests.cs | 103 ------------ .../MessageInspector2Tests.cs | 1 - .../MessageInspectors/Startup.cs | 15 +- .../DataContractSerializationTests.cs | 61 ------- .../Serialization/XmlSerializationTests.cs | 57 ------- src/SoapCore/SoapEndpointExtensions.cs | 12 -- 13 files changed, 1 insertion(+), 649 deletions(-) delete mode 100644 src/SoapCore.Tests/MessageInspector/ClientMessageInspector.cs delete mode 100644 src/SoapCore.Tests/MessageInspector/CustomHeadersEndpointBehavior.cs delete mode 100644 src/SoapCore.Tests/MessageInspector/MessageInspectorMock.cs delete mode 100644 src/SoapCore.Tests/MessageInspector/MessageInspectorTests.cs delete mode 100644 src/SoapCore.Tests/MessageInspector/Startup.cs delete mode 100644 src/SoapCore.Tests/MessageInspectors/InspectorStyle.cs delete mode 100644 src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorMock.cs delete mode 100644 src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorTests.cs diff --git a/src/SoapCore.Tests/MessageInspector/ClientMessageInspector.cs b/src/SoapCore.Tests/MessageInspector/ClientMessageInspector.cs deleted file mode 100644 index 1809e1d4..00000000 --- a/src/SoapCore.Tests/MessageInspector/ClientMessageInspector.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.ServiceModel.Dispatcher; - -namespace SoapCore.Tests.MessageInspector -{ - [Obsolete] - public class ClientMessageInspector : IClientMessageInspector - { - private readonly Dictionary _customHeaders; - - public ClientMessageInspector(Dictionary customHeaders) - { - _customHeaders = customHeaders; - } - - public void AfterReceiveReply(ref Message reply, object correlationState) - { - } - - public object BeforeSendRequest(ref Message request, IClientChannel channel) - { - foreach (var kvp in _customHeaders) - { - var header = MessageHeader.CreateHeader(kvp.Key, "SoapCore", kvp.Value); - request.Headers.Add(header); - } - - return Guid.NewGuid(); - } - } -} diff --git a/src/SoapCore.Tests/MessageInspector/CustomHeadersEndpointBehavior.cs b/src/SoapCore.Tests/MessageInspector/CustomHeadersEndpointBehavior.cs deleted file mode 100644 index d6628120..00000000 --- a/src/SoapCore.Tests/MessageInspector/CustomHeadersEndpointBehavior.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Dispatcher; - -namespace SoapCore.Tests.MessageInspector -{ - [Obsolete] - public class CustomHeadersEndpointBehavior : IEndpointBehavior - { - private Dictionary _customHeaders; - - public CustomHeadersEndpointBehavior(Dictionary customHeaders) - { - _customHeaders = customHeaders; - } - - public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) - { - clientRuntime.ClientMessageInspectors.Add(new ClientMessageInspector(_customHeaders)); - } - - public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) - { - } - - public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) - { - } - - public void Validate(ServiceEndpoint endpoint) - { - } - } -} diff --git a/src/SoapCore.Tests/MessageInspector/MessageInspectorMock.cs b/src/SoapCore.Tests/MessageInspector/MessageInspectorMock.cs deleted file mode 100644 index d609e538..00000000 --- a/src/SoapCore.Tests/MessageInspector/MessageInspectorMock.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.IO; -using System.ServiceModel.Channels; -using System.Xml; -using SoapCore.Extensibility; - -namespace SoapCore.Tests.MessageInspector -{ - [Obsolete] - public class MessageInspectorMock : IMessageInspector - { - public static bool AfterReceivedRequestCalled { get; private set; } - public static bool BeforeSendReplyCalled { get; private set; } - public static string Action { get; private set; } - public static Message LastReceivedMessage { get; private set; } - - public static void Reset() - { - LastReceivedMessage = null; - AfterReceivedRequestCalled = false; - BeforeSendReplyCalled = false; - Action = null; - } - - public object AfterReceiveRequest(ref Message message) - { - if (message == null) - { - throw new System.ArgumentNullException(nameof(message)); - } - - LastReceivedMessage = message; - AfterReceivedRequestCalled = true; - Action = message.Headers.Action; - - using (var buffer = message.CreateBufferedCopy(int.MaxValue)) - { - CorrelationStateMessage state; - using (var stringWriter = new StringWriter()) - { - using (var xmlTextWriter = new XmlTextWriter(stringWriter)) - { - buffer.CreateMessage().WriteMessage(xmlTextWriter); - xmlTextWriter.Flush(); - xmlTextWriter.Close(); - - state = new CorrelationStateMessage - { - InternalUID = "Foo", - Message = stringWriter.ToString() - }; - } - } - - // Assign an new message because body can be read only once... - message = buffer.CreateMessage(); - - return state; - } - } - - public void BeforeSendReply(ref Message reply, object correlationState) - { - if (reply == null) - { - throw new System.ArgumentNullException(nameof(reply)); - } - - if (correlationState == null) - { - throw new System.ArgumentNullException(nameof(correlationState)); - } - - if (correlationState is CorrelationStateMessage state) - { - if (state.InternalUID != "Foo") - { - throw new System.Exception("InternalUID not correct"); - } - } - - BeforeSendReplyCalled = true; - } - - internal class CorrelationStateMessage - { - internal string InternalUID { get; set; } - internal string Message { get; set; } - } - } -} diff --git a/src/SoapCore.Tests/MessageInspector/MessageInspectorTests.cs b/src/SoapCore.Tests/MessageInspector/MessageInspectorTests.cs deleted file mode 100644 index 60a6544d..00000000 --- a/src/SoapCore.Tests/MessageInspector/MessageInspectorTests.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.ServiceModel; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Server.Features; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SoapCore.Tests.Model; - -namespace SoapCore.Tests.MessageInspector -{ - [Obsolete] - [TestClass] - public class MessageInspectorTests - { - private static IWebHost _host; - - [ClassInitialize] - public static void StartServer(TestContext testContext) - { - _host = new WebHostBuilder() - .UseKestrel() - .UseUrls("http://127.0.0.1:0") - .UseStartup() - .Build(); - - var task = _host.RunAsync(); - - while (true) - { - if (_host != null) - { - if (task.IsFaulted && task.Exception != null) - { - throw task.Exception; - } - - if (!task.IsCompleted || !task.IsCanceled) - { - if (!_host.ServerFeatures.Get().Addresses.First().EndsWith(":0")) - { - break; - } - } - } - - Thread.Sleep(2000); - } - } - - [ClassCleanup] - public static async Task StopServer() - { - await _host.StopAsync(); - } - - [TestInitialize] - public void Reset() - { - MessageInspectorMock.Reset(); - } - - public ITestService CreateClient(Dictionary headers = null) - { - var addresses = _host.ServerFeatures.Get(); - var address = addresses.Addresses.Single(); - - var binding = new BasicHttpBinding(); - var endpoint = new EndpointAddress(new Uri(string.Format("{0}/Service.svc", address))); - var channelFactory = new ChannelFactory(binding, endpoint); - channelFactory.Endpoint.EndpointBehaviors.Add(new CustomHeadersEndpointBehavior(headers)); - var serviceClient = channelFactory.CreateChannel(); - return serviceClient; - } - - [TestMethod] - public void AfterReceivedRequestCalled() - { - Assert.IsFalse(MessageInspectorMock.AfterReceivedRequestCalled); - var client = CreateClient(new Dictionary() { { "header1-key", "header1-value" } }); - var result = client.Ping("hello, world"); - Assert.IsTrue(MessageInspectorMock.AfterReceivedRequestCalled); - } - - [TestMethod] - public void AfterReceivedRequestHasAction() - { - Assert.IsNull(MessageInspectorMock.Action); - var client = CreateClient(new Dictionary() { { "header1-key", "header1-value" } }); - var result = client.Ping("hello, world"); - Assert.IsNotNull(MessageInspectorMock.Action); - } - - [TestMethod] - public void BeforeSendReplyCalled() - { - Assert.IsFalse(MessageInspectorMock.BeforeSendReplyCalled); - var client = CreateClient(new Dictionary() { { "header1-key", "header1-value" } }); - var result = client.Ping("hello, world"); - Assert.IsTrue(MessageInspectorMock.BeforeSendReplyCalled); - } - - [TestMethod] - public void SingleSoapHeader() - { - var client = CreateClient(new Dictionary() { { "header1-key", "header1-value" } }); - var result = client.Ping("hello, world"); - var msg = MessageInspectorMock.LastReceivedMessage; - var index = msg.Headers.FindHeader("header1-key", "SoapCore"); - Assert.AreEqual(msg.Headers.GetHeader(index), "header1-value"); - } - - [TestMethod] - public void MultipleSoapHeaders() - { - var client = CreateClient(new Dictionary() { { "header1-key", "header1-value" }, { "header2-key", 2 } }); - var result = client.Ping("hello, world"); - var msg = MessageInspectorMock.LastReceivedMessage; - Assert.AreEqual(msg.Headers.GetHeader(msg.Headers.FindHeader("header1-key", "SoapCore")), "header1-value"); - Assert.AreEqual(msg.Headers.GetHeader(msg.Headers.FindHeader("header2-key", "SoapCore")), 2); - } - - [TestMethod] - public void ComplexSoapHeader() - { - var client = CreateClient(new Dictionary() - { - { - "complex", new ComplexModelInput() - { - StringProperty = "hello, world", - IntProperty = 1000, - ListProperty = new List { "test", "list", "of", "strings" }, - DateTimeOffsetProperty = new DateTimeOffset(2018, 12, 31, 13, 59, 59, TimeSpan.FromHours(1)) - } - } - }); - - var result = client.Ping(string.Empty); - var msg = MessageInspectorMock.LastReceivedMessage; - var complex = msg.Headers.GetHeader(msg.Headers.FindHeader("complex", "SoapCore")); - Assert.AreEqual(complex.StringProperty, "hello, world"); - Assert.AreEqual(complex.IntProperty, 1000); - CollectionAssert.AreEqual(complex.ListProperty, new List { "test", "list", "of", "strings" }); - } - } -} diff --git a/src/SoapCore.Tests/MessageInspector/Startup.cs b/src/SoapCore.Tests/MessageInspector/Startup.cs deleted file mode 100644 index 36b7baad..00000000 --- a/src/SoapCore.Tests/MessageInspector/Startup.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.ServiceModel; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Logging; - -namespace SoapCore.Tests.MessageInspector -{ - [Obsolete] - public class Startup - { - public void ConfigureServices(IServiceCollection services) - { - services.AddSoapCore(); - services.TryAddSingleton(); - services.AddSoapMessageInspector(new MessageInspectorMock()); - services.AddMvc(); - } - -#if !NETCOREAPP3_0_OR_GREATER - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) - { - app.UseSoapEndpoint("/Service.svc", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer); - app.UseMvc(); - } -#else - public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) - { - app.UseRouting(); - - app.UseEndpoints(x => - { - x.UseSoapEndpoint("/Service.svc", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer); - }); - } -#endif - } -} diff --git a/src/SoapCore.Tests/MessageInspectors/InspectorStyle.cs b/src/SoapCore.Tests/MessageInspectors/InspectorStyle.cs deleted file mode 100644 index d00f4554..00000000 --- a/src/SoapCore.Tests/MessageInspectors/InspectorStyle.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SoapCore.Tests.MessageInspectors -{ - public enum InspectorStyle - { - MessageInspector, - MessageInspector2 - } -} diff --git a/src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorMock.cs b/src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorMock.cs deleted file mode 100644 index 316e1a1e..00000000 --- a/src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorMock.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.ServiceModel; -using System.ServiceModel.Channels; -using SoapCore.Extensibility; - -namespace SoapCore.Tests.MessageInspectors.MessageInspector -{ - [Obsolete] - public class MessageInspectorMock : IMessageInspector - { - public static bool AfterReceivedRequestCalled { get; private set; } - public static bool BeforeSendReplyCalled { get; private set; } - public static Message LastReceivedMessage { get; private set; } - - public static void Reset() - { - LastReceivedMessage = null; - AfterReceivedRequestCalled = false; - BeforeSendReplyCalled = false; - } - - public object AfterReceiveRequest(ref Message message) - { - LastReceivedMessage = message; - AfterReceivedRequestCalled = true; - - // Validate Message - ValidateMessage(ref message); - - return null; - } - - public void BeforeSendReply(ref Message reply, object correlationState) - { - BeforeSendReplyCalled = true; - } - - private void ValidateMessage(ref Message message) - { - throw new FaultException(new FaultReason("Message is invalid."), new FaultCode("Sender"), null); - } - } -} diff --git a/src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorTests.cs b/src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorTests.cs deleted file mode 100644 index 4dbaa1c5..00000000 --- a/src/SoapCore.Tests/MessageInspectors/MessageInspector/MessageInspectorTests.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Linq; -using System.ServiceModel; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Server.Features; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace SoapCore.Tests.MessageInspectors.MessageInspector -{ - [Obsolete] - [TestClass] - public class MessageInspectorTests - { - private static IWebHost _host; - - [ClassInitialize] - public static void StartServer(TestContext testContext) - { - _host = new WebHostBuilder() - .UseKestrel() - .UseUrls("http://127.0.0.1:0") - .UseStartup() - .UseSetting("InspectorStyle", InspectorStyle.MessageInspector.ToString()) - .Build(); - - var task = _host.RunAsync(); - - while (true) - { - if (_host != null) - { - if (task.IsFaulted && task.Exception != null) - { - throw task.Exception; - } - - if (!task.IsCompleted || !task.IsCanceled) - { - if (!_host.ServerFeatures.Get().Addresses.First().EndsWith(":0")) - { - break; - } - } - } - - Thread.Sleep(2000); - } - } - - [ClassCleanup] - public static async Task StopServer() - { - await _host.StopAsync(); - } - - [TestInitialize] - public void Reset() - { - MessageInspectorMock.Reset(); - } - - public ITestService CreateClient() - { - var addresses = _host.ServerFeatures.Get(); - var address = addresses.Addresses.Single(); - - var binding = new BasicHttpBinding(); - var endpoint = new EndpointAddress(new Uri(string.Format("{0}/Service.svc", address))); - var channelFactory = new ChannelFactory(binding, endpoint); - var serviceClient = channelFactory.CreateChannel(); - return serviceClient; - } - - [TestMethod] - [ExpectedException(typeof(FaultException))] - public void AfterReceivedRequestCalled() - { - Assert.IsFalse(MessageInspectorMock.AfterReceivedRequestCalled); - var client = CreateClient(); - var result = client.Ping("Hello World"); - Assert.IsTrue(MessageInspectorMock.AfterReceivedRequestCalled); - } - - [TestMethod] - [ExpectedException(typeof(FaultException))] - public void BeforeSendReplyShouldNotBeCalled() - { - Assert.IsFalse(MessageInspectorMock.BeforeSendReplyCalled); - var client = CreateClient(); - var result = client.Ping("Hello World"); - Assert.IsFalse(MessageInspectorMock.BeforeSendReplyCalled); - } - - [TestMethod] - public void AfterReceivedThrowsException() - { - var client = CreateClient(); - Assert.ThrowsException(() => client.Ping("Hello World")); - } - } -} diff --git a/src/SoapCore.Tests/MessageInspectors/MessageInspector2/MessageInspector2Tests.cs b/src/SoapCore.Tests/MessageInspectors/MessageInspector2/MessageInspector2Tests.cs index 7758aa92..b25fd14e 100644 --- a/src/SoapCore.Tests/MessageInspectors/MessageInspector2/MessageInspector2Tests.cs +++ b/src/SoapCore.Tests/MessageInspectors/MessageInspector2/MessageInspector2Tests.cs @@ -19,7 +19,6 @@ public static void StartServer(TestContext testContext) .UseKestrel() .UseUrls("http://localhost:7051") .UseStartup() - .UseSetting("InspectorStyle", InspectorStyle.MessageInspector2.ToString()) .Build(); host.Run(); diff --git a/src/SoapCore.Tests/MessageInspectors/Startup.cs b/src/SoapCore.Tests/MessageInspectors/Startup.cs index 9eaa1c77..95991e84 100644 --- a/src/SoapCore.Tests/MessageInspectors/Startup.cs +++ b/src/SoapCore.Tests/MessageInspectors/Startup.cs @@ -5,7 +5,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; -using SoapCore.Tests.MessageInspectors.MessageInspector; using SoapCore.Tests.MessageInspectors.MessageInspector2; namespace SoapCore.Tests.MessageInspectors @@ -15,28 +14,16 @@ public class Startup public Startup(IConfiguration configuration) { Configuration = configuration; - InspectorStyle = configuration.GetValue("InspectorStyle"); } public IConfiguration Configuration { get; } - public InspectorStyle InspectorStyle { get; } public void ConfigureServices(IServiceCollection services) { services.AddSoapCore(); services.TryAddSingleton(); - switch (InspectorStyle) - { - case InspectorStyle.MessageInspector: -#pragma warning disable CS0612 // Type or member is obsolete - services.AddSoapMessageInspector(new MessageInspectorMock()); -#pragma warning restore CS0612 // Type or member is obsolete - break; - case InspectorStyle.MessageInspector2: - services.AddSoapMessageInspector(new MessageInspector2Mock()); - break; - } + services.AddSoapMessageInspector(new MessageInspector2Mock()); services.AddMvc(); } diff --git a/src/SoapCore.Tests/Serialization/DataContractSerializationTests.cs b/src/SoapCore.Tests/Serialization/DataContractSerializationTests.cs index 9de3a4b7..907c3207 100644 --- a/src/SoapCore.Tests/Serialization/DataContractSerializationTests.cs +++ b/src/SoapCore.Tests/Serialization/DataContractSerializationTests.cs @@ -199,67 +199,6 @@ public void TestPingComplexModelSerializationWithNoNameSpace(SoapSerializer soap pingComplexModelResult_client.ShouldDeepEqual(ComplexModel2.CreateSample2()); } - [Theory(Skip = "incompatible with all serializers")] - [MemberData(nameof(ServiceFixture.SoapSerializersList), MemberType = typeof(ServiceFixture))] - public void TestPingComplexModelOutAndRefSerialization(SoapSerializer soapSerializer) - { - var sampleServiceClient = _fixture.GetSampleServiceClient(soapSerializer); - - _fixture.ServiceMock - .Setup(x => x.PingComplexModelOutAndRef( - It.IsAny(), - ref It.Ref.IsAny, - It.IsAny(), - ref It.Ref.IsAny, - It.IsAny(), - out It.Ref.IsAny, - out It.Ref.IsAny)) - .Callback(new PingComplexModelOutAndRefCallback( - ( - ComplexModel1 inputModel_service, - ref ComplexModel2 responseModelRef1_service, - ComplexObject data1_service, - ref ComplexModel1 responseModelRef2_service, - ComplexObject data2_service, - out ComplexModel2 responseModelOut1_service, - out ComplexModel1 responseModelOut2_service) => - { - // check input paremeters serialization - inputModel_service.ShouldDeepEqual(ComplexModel1.CreateSample2()); - responseModelRef1_service.ShouldDeepEqual(ComplexModel2.CreateSample1()); - responseModelRef2_service.ShouldDeepEqual(ComplexModel1.CreateSample2()); - data1_service.ShouldDeepEqual(ComplexObject.CreateSample1()); - data2_service.ShouldDeepEqual(ComplexObject.CreateSample2()); - - //sample response - responseModelRef1_service = ComplexModel2.CreateSample2(); - responseModelRef2_service = ComplexModel1.CreateSample1(); - responseModelOut1_service = ComplexModel2.CreateSample3(); - responseModelOut2_service = ComplexModel1.CreateSample1(); - })) - .Returns(true); - - var responseModelRef1_client = ComplexModel2.CreateSample1(); - var responseModelRef2_client = ComplexModel1.CreateSample2(); - - var pingComplexModelOutAndRefResult_client = - sampleServiceClient.PingComplexModelOutAndRef( - ComplexModel1.CreateSample2(), - ref responseModelRef1_client, - ComplexObject.CreateSample1(), - ref responseModelRef2_client, - ComplexObject.CreateSample2(), - out var responseModelOut1_client, - out var responseModelOut2_client); - - // check output paremeters serialization - pingComplexModelOutAndRefResult_client.ShouldBeTrue(); - responseModelRef1_client.ShouldDeepEqual(ComplexModel2.CreateSample2()); - responseModelRef2_client.ShouldDeepEqual(ComplexModel1.CreateSample1()); - responseModelOut1_client.ShouldDeepEqual(ComplexModel2.CreateSample3()); - responseModelOut2_client.ShouldDeepEqual(ComplexModel1.CreateSample1()); - } - // not compatible with XmlSerializer [Theory] [InlineData(SoapSerializer.DataContractSerializer)] diff --git a/src/SoapCore.Tests/Serialization/XmlSerializationTests.cs b/src/SoapCore.Tests/Serialization/XmlSerializationTests.cs index d5dabecc..baa3c260 100644 --- a/src/SoapCore.Tests/Serialization/XmlSerializationTests.cs +++ b/src/SoapCore.Tests/Serialization/XmlSerializationTests.cs @@ -275,24 +275,6 @@ public void TestPingComplexArrayModel(SoapSerializer soapSerializer) result.ShouldDeepEqual(new[] { ComplexModel1.CreateSample1() }); } - [Theory(Skip = "test not correct")] - [InlineData(SoapSerializer.XmlSerializer)] - public void TestPingComplexArrayModelWithXmlArray(SoapSerializer soapSerializer) - { - var sampleServiceClient = _fixture.GetSampleServiceClient(soapSerializer); - - _fixture.ServiceMock - .Setup(x => x.PingComplexModelArray(It.IsAny(), It.IsAny())) - .Callback((ComplexModel1[] input, ComplexModel2[] input2) => - { - input.ShouldDeepEqual(new[] { ComplexModel1.CreateSample1() }); - input2.ShouldDeepEqual(new[] { ComplexModel2.CreateSample1() }); - }) - .Returns(new[] { ComplexModel1.CreateSample1() }); - var result = sampleServiceClient.PingComplexModelArrayWithXmlArray(new[] { ComplexModel1.CreateSample1() }, new[] { ComplexModel2.CreateSample1() }); - result.ShouldDeepEqual(new[] { ComplexModel1.CreateSample1() }); - } - [Theory] [InlineData(SoapSerializer.XmlSerializer)] public void TestPingStringArray(SoapSerializer soapSerializer) @@ -325,22 +307,6 @@ public void TestPingByteArray(SoapSerializer soapSerializer) result.ShouldDeepEqual(data); } - [Theory(Skip = "test not correct")] - [InlineData(SoapSerializer.XmlSerializer)] - public void TestPingStringArrayWithXmlArray(SoapSerializer soapSerializer) - { - var sampleServiceClient = _fixture.GetSampleServiceClient(soapSerializer); - - var data = new[] { "string", "string1" }; - - _fixture.ServiceMock - .Setup(x => x.PingStringArray(It.IsAny())) - .Callback((string[] input) => { input.ShouldDeepEqual(data); }) - .Returns(data); - var result = sampleServiceClient.PingStringArrayWithXmlArray(data); - result.ShouldDeepEqual(data); - } - [Theory] [InlineData(SoapSerializer.XmlSerializer)] public void TestResponseIntArray(SoapSerializer soapSerializer) @@ -818,29 +784,6 @@ public void TestPingComplexLegacyModelResponse(SoapSerializer soapSerializer) Assert.Equal(new[] { expected }, actual.UnqualifiedItems); } - //https://github.com/DigDes/SoapCore/issues/379 - [Theory(Skip = "not reproducible")] - [InlineData(SoapSerializer.XmlSerializer)] - public void TestParameterWithXmlElementNamespace(SoapSerializer soapSerializer) - { - var sampleServiceClient = _fixture.GetSampleServiceClient(soapSerializer); - var obj = new DataContractWithoutNamespace - { - IntProperty = 1234, - StringProperty = "2222" - }; - - _fixture.ServiceMock.Setup(x => x.GetComplexObjectWithXmlElement(obj)).Returns(obj); - _fixture.ServiceMock.Setup(x => x.GetComplexObjectWithXmlElement(It.IsAny())).Callback( - (DataContractWithoutNamespace o) => - { - Assert.Equal(obj.IntProperty, o.IntProperty); - Assert.Equal(obj.StringProperty, o.StringProperty); - }); - - sampleServiceClient.GetComplexObjectWithXmlElement(obj); - } - [Theory] [InlineData(SoapSerializer.XmlSerializer)] public void TestPingComplexMessageHeaderArraySerialization(SoapSerializer soapSerializer) diff --git a/src/SoapCore/SoapEndpointExtensions.cs b/src/SoapCore/SoapEndpointExtensions.cs index 833a28f0..c10b7c88 100644 --- a/src/SoapCore/SoapEndpointExtensions.cs +++ b/src/SoapCore/SoapEndpointExtensions.cs @@ -375,12 +375,6 @@ public static IServiceCollection AddSoapExceptionTransformer(this IServiceCollec return serviceCollection; } - [Obsolete] - public static IServiceCollection AddSoapMessageInspector(this IServiceCollection serviceCollection, IMessageInspector messageInspector) - { - return serviceCollection.AddSoapMessageInspector(new ObsoleteMessageInspector(messageInspector)); - } - public static IServiceCollection AddSoapMessageInspector(this IServiceCollection serviceCollection) where TService : class, IMessageInspector2 { @@ -394,12 +388,6 @@ public static IServiceCollection AddSoapMessageInspector(this IServiceCollection return serviceCollection; } - [Obsolete] - public static IServiceCollection AddSoapMessageFilter(this IServiceCollection serviceCollection, IMessageFilter messageFilter) - { - return serviceCollection.AddSoapMessageFilter(new ObsoleteMessageFilter(messageFilter)); - } - public static IServiceCollection AddSoapMessageFilter(this IServiceCollection serviceCollection, IAsyncMessageFilter messageFilter) { serviceCollection.AddSingleton(messageFilter);