diff --git a/src/Test/Desktop/OpenRiaServices.Common.Test/ExceptionHelper.cs b/src/Test/Desktop/OpenRiaServices.Common.Test/ExceptionHelper.cs index b30778cc..9111ae38 100644 --- a/src/Test/Desktop/OpenRiaServices.Common.Test/ExceptionHelper.cs +++ b/src/Test/Desktop/OpenRiaServices.Common.Test/ExceptionHelper.cs @@ -260,5 +260,12 @@ public static WebException ExpectWebException(GenericDelegate del, string messag Assert.AreEqual(webExceptionStatus, e.Status); return e; } + + public static InvalidCastException ExpectInvalidCastException(GenericDelegate del, string message) + { + InvalidCastException e = ExpectExceptionHelper(del); + Assert.AreEqual(message, e.Message); + return e; + } } } diff --git a/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/Main.cs b/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/Main.cs index 93e84776..af37d2e6 100644 --- a/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/Main.cs +++ b/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/Main.cs @@ -31,14 +31,6 @@ public static void AssemblyInit(TestContext context) UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, }); -#if NETFRAMEWORK -#pragma warning disable CS0618 // Type or member is obsolete - DomainContext.DomainClientFactory = new Web.WebDomainClientFactory() - { - ServerBaseUri = TestURIs.RootURI, - }; -#pragma warning restore CS0618 // Type or member is obsolete -#endif // Note: Below gives errors when running (at least BinaryHttpDomainClientFactory) against AspNetCore // It seems to cache results even with "private, no-store" diff --git a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/DataServiceTests.cs b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/DataServiceTests.cs index 09388382..311635ae 100644 --- a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/DataServiceTests.cs +++ b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/DataServiceTests.cs @@ -486,6 +486,9 @@ public void TestInvalidProviderName() /// Verify that if an invalid DomainOperationEntry name is specified, that the Load /// operation finishes with the expected WebResponse.StatusCode. /// +#if ASPNETCORE + [Ignore("BinaryHttpDomainClientFactory does not validate if method exists, and since name is always specified by code generation it is not important to validate it")] +#endif [TestMethod] public void TestInvalidMethodName() { diff --git a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/QueryTests.cs b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/QueryTests.cs index c679bb51..25971293 100644 --- a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/QueryTests.cs +++ b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/QueryTests.cs @@ -1952,12 +1952,19 @@ public void TestDomainOperationEntry_IncorrectParameterType() paramValues["subCategoryID"] = "Foobar"; paramValues["minListPrice"] = 50; paramValues["color"] = "Yellow"; - +#if ASPNETCORE + ExceptionHelper.ExpectInvalidCastException(delegate + { + var query = ctxt.CreateQuery("GetProductsMultipleParams", paramValues, false, true); + ctxt.Load(query, false); + }, "Specified cast is not valid."); +#else ExceptionHelper.ExpectArgumentException(delegate { var query = ctxt.CreateQuery("GetProductsMultipleParams", paramValues, false, true); ctxt.Load(query, false); }, "Object of type 'System.String' cannot be converted to type 'System.Int32'."); +#endif } /// @@ -1999,6 +2006,9 @@ await ValidateQueryException(ctxt, query, ex => }); } +#if ASPNETCORE + [Ignore("BinaryHttpDomainClientFactory does not validate if method exists, and since name is always specified by code generation it is not important to validate it")] +#endif [TestMethod] public async Task TestServerExceptions_QueryOnNonExistentMethod() { @@ -2006,7 +2016,8 @@ public async Task TestServerExceptions_QueryOnNonExistentMethod() var query = ctxt.CreateQuery("NonExistentMethod", null, false, true); await ValidateQueryException(ctxt, query, ex => { - // REVIEW: Assert the error message. + Assert.IsTrue(ex.Message.StartsWith("Load operation failed for query 'NonExistentMethod'. An error occurred while receiving the HTTP response to")); + Assert.IsTrue(ex.Message.EndsWith("This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.")); Assert.IsNotNull(ex.InnerException as CommunicationException, "Expected CommunicationException"); Assert.IsNotNull(ex.InnerException.InnerException as WebException, "Expected WebException"); });