From 73531b562b4083eaaaf04bf99117fa395b414eac Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Wed, 24 Apr 2024 23:54:54 +0200 Subject: [PATCH] thrift URIs --- .../Tests/Thrift.Tests/UriFactory/TUriFactoryTests.cs | 10 +++++----- lib/netstd/Thrift/TFactory.cs | 3 ++- lib/netstd/Thrift/TThriftUri.cs | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/netstd/Tests/Thrift.Tests/UriFactory/TUriFactoryTests.cs b/lib/netstd/Tests/Thrift.Tests/UriFactory/TUriFactoryTests.cs index 220479e721d..36db33c5b6d 100644 --- a/lib/netstd/Tests/Thrift.Tests/UriFactory/TUriFactoryTests.cs +++ b/lib/netstd/Tests/Thrift.Tests/UriFactory/TUriFactoryTests.cs @@ -38,10 +38,10 @@ private enum BuiltinLayeredTransports { none, framed, buffered }; private static HashSet GetAllSocketTransports() { // these are known to slow down the test - return new HashSet { + return [ BuiltinTransports.socket, BuiltinTransports.tlssocket, - }; + ]; } [TestMethod] @@ -78,8 +78,8 @@ public void TFactory_Can_Parse_And_Construct_Socket_Transports() private void InternalTestMethodImplementation(IEnumerable protocols, IEnumerable transports, IEnumerable decorators, IEnumerable layeredTransports) { // those must not be empty to have at least one test run - Assert.IsTrue(protocols.Count() > 0); - Assert.IsTrue(transports.Count() > 0); + Assert.IsTrue(protocols.Any()); + Assert.IsTrue(transports.Any()); // "none" should always be included and should be first Assert.IsTrue(decorators.FirstOrDefault() == BuiltinProtocolDecorators.none); @@ -126,7 +126,7 @@ private void InternalTestMethodImplementation(IEnumerable prot File.Delete(OutputFile); } - private string MakeLayeredTransportString(BuiltinLayeredTransports layer) + private static string MakeLayeredTransportString(BuiltinLayeredTransports layer) { return layer switch { diff --git a/lib/netstd/Thrift/TFactory.cs b/lib/netstd/Thrift/TFactory.cs index 211a84cc495..5493bdd8b1b 100644 --- a/lib/netstd/Thrift/TFactory.cs +++ b/lib/netstd/Thrift/TFactory.cs @@ -23,7 +23,8 @@ using Thrift.Transport; using Thrift.Transport.Client; -#pragma warning disable IDE0028 // collection init is net8 only +#pragma warning disable IDE0079 // unneeded suppression -> all except net8 +#pragma warning disable IDE0028 // simplify collection init -> net8 only namespace Thrift { diff --git a/lib/netstd/Thrift/TThriftUri.cs b/lib/netstd/Thrift/TThriftUri.cs index d8992857c9c..c42ac7596be 100644 --- a/lib/netstd/Thrift/TThriftUri.cs +++ b/lib/netstd/Thrift/TThriftUri.cs @@ -21,8 +21,8 @@ using System.Linq; using System.Text; -#pragma warning disable IDE0028 // net8 only -#pragma warning disable IDE0074 // net8 only +//#pragma warning disable IDE0028 // net8 only +//#pragma warning disable IDE0074 // net8 only namespace Thrift { @@ -32,7 +32,7 @@ public class TThriftUri // must either be empty or begin with a slash("/") character.If a URI // does not contain an authority component, then the path cannot begin // with two slash characters("//"). - public const string THRIFT_URI_SCHEME = "thrift:/"; + public const string THRIFT_URI_SCHEME = "thrift:"; public readonly string Protocol; public readonly string Transport;