* remove redundant local variable assignments in OnValueSize
* remove redundant local variable assignments in OnValueSize
* clean up some whitespace
* remove redundant ClientId parameter in ActiveSendReceiveClientLink
* use pattern matching
* redundant braces
* redundant method
* remove redundant doco
* simplify doc file generation
* remove settings that are inferred from the project file name
* remove redundant test attributes
* remove redundant async state machines
This commit is contained in:
Simon Cropp 2017-09-09 12:09:52 +10:00 коммит произвёл Neeraj Makam
Родитель e650ac4c4e
Коммит 51f8d77f04
62 изменённых файлов: 293 добавлений и 467 удалений

Просмотреть файл

@ -8,7 +8,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
sealed class ActiveSendReceiveClientLink : ActiveClientLinkObject
{
public ActiveSendReceiveClientLink(AmqpLink link, Uri endpointUri, string audience, string[] requiredClaims, DateTime authorizationValidUntilUtc, string clientId)
public ActiveSendReceiveClientLink(AmqpLink link, Uri endpointUri, string audience, string[] requiredClaims, DateTime authorizationValidUntilUtc)
: base(link, endpointUri, audience, requiredClaims, authorizationValidUntilUtc)
{
this.Link = link;

Просмотреть файл

@ -15,7 +15,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
static class AmqpExceptionHelper
{
static readonly Dictionary<string, AmqpResponseStatusCode> ConditionToStatusMap = new Dictionary<string, AmqpResponseStatusCode>()
static readonly Dictionary<string, AmqpResponseStatusCode> ConditionToStatusMap = new Dictionary<string, AmqpResponseStatusCode>
{
{ AmqpClientConstants.TimeoutError.Value, AmqpResponseStatusCode.RequestTimeout },
{ AmqpErrorCode.NotFound.Value, AmqpResponseStatusCode.NotFound },
@ -179,8 +179,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
return new ServiceBusCommunicationException(message, aggregateException);
case IOException _:
var socketException = exception.InnerException as SocketException;
if (socketException != null)
if (exception.InnerException is SocketException socketException)
{
message = builder.AppendFormat(CultureInfo.InvariantCulture, $" ErrorCode: {socketException.SocketErrorCode}").ToString();
}

Просмотреть файл

@ -57,7 +57,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
if (dataList == null)
{
dataList = new List<Data>() { ToData(firstAmqpMessage) };
dataList = new List<Data> { ToData(firstAmqpMessage) };
}
dataList.Add(ToData(amqpMessage));
@ -93,7 +93,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
public static AmqpMessage SBMessageToAmqpMessage(SBMessage sbMessage)
{
var amqpMessage = sbMessage.Body == null ? AmqpMessage.Create() : AmqpMessage.Create(new Data () { Value = new ArraySegment<byte>(sbMessage.Body) });
var amqpMessage = sbMessage.Body == null ? AmqpMessage.Create() : AmqpMessage.Create(new Data { Value = new ArraySegment<byte>(sbMessage.Body) });
amqpMessage.Properties.MessageId = sbMessage.MessageId;
amqpMessage.Properties.CorrelationId = sbMessage.CorrelationId;
@ -398,7 +398,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
case AmqpCorrelationFilterCodec.Code:
var amqpCorrelationFilter = (AmqpCorrelationFilterCodec)amqpFilter;
var correlationFilter = new CorrelationFilter()
var correlationFilter = new CorrelationFilter
{
CorrelationId = amqpCorrelationFilter.CorrelationId,
MessageId = amqpCorrelationFilter.MessageId,

Просмотреть файл

@ -15,7 +15,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
AmqpRequestMessage(string operation, TimeSpan timeout, string trackingId)
{
this.Map = new AmqpMap();
this.requestMessage = AmqpMessage.Create(new AmqpValue() { Value = this.Map });
this.requestMessage = AmqpMessage.Create(new AmqpValue { Value = this.Map });
this.requestMessage.ApplicationProperties.Map[ManagementConstants.Request.Operation] = operation;
this.requestMessage.ApplicationProperties.Map[ManagementConstants.Properties.ServerTimeout] = (uint)timeout.TotalMilliseconds;
this.requestMessage.ApplicationProperties.Map[ManagementConstants.Properties.TrackingId] = trackingId ?? Guid.NewGuid().ToString();

Просмотреть файл

@ -112,17 +112,15 @@ namespace Microsoft.Azure.ServiceBus.Amqp.Framing
protected override int OnValueSize()
{
int valueSize = AmqpCodec.GetStringEncodeSize(this.CorrelationId);
valueSize += AmqpCodec.GetStringEncodeSize(this.MessageId);
valueSize += AmqpCodec.GetStringEncodeSize(this.To);
valueSize += AmqpCodec.GetStringEncodeSize(this.ReplyTo);
valueSize += AmqpCodec.GetStringEncodeSize(this.Label);
valueSize += AmqpCodec.GetStringEncodeSize(this.SessionId);
valueSize += AmqpCodec.GetStringEncodeSize(this.ReplyToSessionId);
valueSize += AmqpCodec.GetStringEncodeSize(this.ContentType);
valueSize += AmqpCodec.GetMapEncodeSize(this.properties);
return valueSize;
return AmqpCodec.GetStringEncodeSize(this.CorrelationId) +
AmqpCodec.GetStringEncodeSize(this.MessageId) +
AmqpCodec.GetStringEncodeSize(this.To) +
AmqpCodec.GetStringEncodeSize(this.ReplyTo) +
AmqpCodec.GetStringEncodeSize(this.Label) +
AmqpCodec.GetStringEncodeSize(this.SessionId) +
AmqpCodec.GetStringEncodeSize(this.ReplyToSessionId) +
AmqpCodec.GetStringEncodeSize(this.ContentType) +
AmqpCodec.GetMapEncodeSize(this.properties);
}
}
}

Просмотреть файл

@ -70,12 +70,10 @@ namespace Microsoft.Azure.ServiceBus.Amqp.Framing
protected override int OnValueSize()
{
var valueSize = AmqpCodec.GetSerializableEncodeSize(this.Filter);
valueSize += AmqpCodec.GetSerializableEncodeSize(this.Action);
valueSize += AmqpCodec.GetStringEncodeSize(this.RuleName);
valueSize += AmqpCodec.GetTimeStampEncodeSize(this.CreatedAt);
return valueSize;
return AmqpCodec.GetSerializableEncodeSize(this.Filter) +
AmqpCodec.GetSerializableEncodeSize(this.Action) +
AmqpCodec.GetStringEncodeSize(this.RuleName) +
AmqpCodec.GetTimeStampEncodeSize(this.CreatedAt);
}
}
}

Просмотреть файл

@ -51,10 +51,8 @@ namespace Microsoft.Azure.ServiceBus.Amqp.Framing
protected override int OnValueSize()
{
var valueSize = AmqpCodec.GetStringEncodeSize(this.Expression);
valueSize += AmqpCodec.GetIntEncodeSize(this.CompatibilityLevel);
return valueSize;
return AmqpCodec.GetStringEncodeSize(this.Expression) +
AmqpCodec.GetIntEncodeSize(this.CompatibilityLevel);
}
}

Просмотреть файл

@ -59,10 +59,8 @@ namespace Microsoft.Azure.ServiceBus.Amqp.Framing
protected override int OnValueSize()
{
var valueSize = AmqpCodec.GetStringEncodeSize(this.SqlExpression);
valueSize += AmqpCodec.GetIntEncodeSize(this.CompatibilityLevel);
return valueSize;
return AmqpCodec.GetStringEncodeSize(this.SqlExpression) +
AmqpCodec.GetIntEncodeSize(this.CompatibilityLevel);
}
}
}

Просмотреть файл

@ -19,10 +19,6 @@ namespace Microsoft.Azure.ServiceBus
readonly string clientTypeName;
readonly object syncLock;
/// <summary></summary>
/// <param name="clientTypeName"></param>
/// <param name="postfix"></param>
/// <param name="retryPolicy"></param>
protected ClientEntity(string clientTypeName, string postfix, RetryPolicy retryPolicy)
{
this.clientTypeName = clientTypeName;
@ -59,7 +55,6 @@ namespace Microsoft.Azure.ServiceBus
/// <summary>
/// Closes the Client. Closes the connections opened by it.
/// </summary>
/// <returns>The asynchronous operation</returns>
public async Task CloseAsync()
{
bool callClose = false;
@ -95,12 +90,8 @@ namespace Microsoft.Azure.ServiceBus
/// <param name="serviceBusPluginName">The name <see cref="ServiceBusPlugin.Name"/> to be unregistered</param>
public abstract void UnregisterPlugin(string serviceBusPluginName);
/// <summary></summary>
/// <returns></returns>
protected abstract Task OnClosingAsync();
/// <summary></summary>
/// <returns></returns>
protected static long GetNextId()
{
return Interlocked.Increment(ref nextId);
@ -130,7 +121,6 @@ namespace Microsoft.Azure.ServiceBus
/// <summary>
/// Updates the client id.
/// </summary>
/// <param name="newClientId"></param>
internal void UpdateClientId(string newClientId)
{
MessagingEventSource.Log.UpdateClientId(this.ClientId, newClientId);

Просмотреть файл

@ -98,7 +98,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// </remarks>
/// <param name="lockTokens">An <see cref="IEnumerable{T}"/> containing the lock tokens of the corresponding messages to complete.</param>
/// This operation can only be performed on messages that were received by this receiver.
/// <returns>The asynchronous operation.</returns>
Task CompleteAsync(IEnumerable<string> lockTokens);
/// <summary>Indicates that the receiver wants to defer the processing for the message.</summary>
@ -111,7 +110,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// Deferring messages does not impact message's expiration, meaning that deferred messages can still expire.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
Task DeferAsync(string lockToken);
/// <summary>
@ -124,7 +122,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// If processing of the message requires longer than this duration, the lock needs to be renewed. For each renewal, the lock is renewed by
/// the entity's LockDuration.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
Task RenewLockAsync(Message message);
/// <summary>

Просмотреть файл

@ -76,7 +76,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// only when <see cref="ReceiveMode"/> is set to <see cref="ServiceBus.ReceiveMode.PeekLock"/>.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
Task CompleteAsync(string lockToken);
/// <summary>
@ -88,7 +87,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// Abandoning a message will increase the delivery count on the message.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
Task AbandonAsync(string lockToken);
/// <summary>
@ -102,7 +100,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// You can use <see cref="EntityNameHelper.FormatDeadLetterPath(string)"/> to help with this.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
Task DeadLetterAsync(string lockToken);
}
}

Просмотреть файл

@ -380,7 +380,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// only when <see cref="ReceiveMode"/> is set to <see cref="ServiceBus.ReceiveMode.PeekLock"/>.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public Task CompleteAsync(string lockToken)
{
return this.CompleteAsync(new[] { lockToken });
@ -395,7 +394,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <param name="lockTokens">An <see cref="IEnumerable{T}"/> containing the lock tokens of the corresponding messages to complete.</param>
/// <returns>The asynchronous operation.</returns>
public async Task CompleteAsync(IEnumerable<string> lockTokens)
{
this.ThrowIfClosed();
@ -431,7 +429,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// Abandoning a message will increase the delivery count on the message.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public async Task AbandonAsync(string lockToken)
{
this.ThrowIfClosed();
@ -466,7 +463,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// Deferring messages does not impact message's expiration, meaning that deferred messages can still expire.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public async Task DeferAsync(string lockToken)
{
this.ThrowIfClosed();
@ -503,7 +499,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// You can use <see cref="EntityNameHelper.FormatDeadLetterPath(string)"/> to help with this.
/// This operation can only be performed on messages that were received by this receiver.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public async Task DeadLetterAsync(string lockToken)
{
this.ThrowIfClosed();
@ -539,7 +534,6 @@ namespace Microsoft.Azure.ServiceBus.Core
/// If processing of the message requires longer than this duration, the lock needs to be renewed. For each renewal, the lock is renewed by
/// the entity's LockDuration.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public async Task RenewLockAsync(Message message)
{
this.ThrowIfClosed();
@ -748,8 +742,6 @@ namespace Microsoft.Azure.ServiceBus.Core
return responseMessage;
}
/// <summary></summary>
/// <returns>The asynchronous operation.</returns>
protected override async Task OnClosingAsync()
{
this.clientLinkManager.Close();
@ -771,10 +763,6 @@ namespace Microsoft.Azure.ServiceBus.Core
}
}
/// <summary></summary>
/// <param name="maxMessageCount"></param>
/// <param name="serverWaitTime"></param>
/// <returns>The asynchronous operation.</returns>
protected virtual async Task<IList<Message>> OnReceiveAsync(int maxMessageCount, TimeSpan serverWaitTime)
{
ReceivingAmqpLink receiveLink = null;
@ -852,10 +840,6 @@ namespace Microsoft.Azure.ServiceBus.Core
}
}
/// <summary></summary>
/// <param name="fromSequenceNumber"></param>
/// <param name="messageCount"></param>
/// <returns>The asynchronous operation.</returns>
protected virtual async Task<IList<Message>> OnPeekAsync(long fromSequenceNumber, int messageCount = 1)
{
try
@ -912,9 +896,6 @@ namespace Microsoft.Azure.ServiceBus.Core
}
}
/// <summary></summary>
/// <param name="sequenceNumbers"></param>
/// <returns>The asynchronous operation.</returns>
protected virtual async Task<IList<Message>> OnReceiveDeferredMessageAsync(IEnumerable<long> sequenceNumbers)
{
List<Message> messages = new List<Message>();
@ -957,9 +938,6 @@ namespace Microsoft.Azure.ServiceBus.Core
return messages;
}
/// <summary></summary>
/// <param name="lockTokens"></param>
/// <returns>The asynchronous operation.</returns>
protected virtual async Task OnCompleteAsync(IEnumerable<string> lockTokens)
{
var lockTokenGuids = lockTokens.Select(lt => new Guid(lt));
@ -973,9 +951,6 @@ namespace Microsoft.Azure.ServiceBus.Core
}
}
/// <summary></summary>
/// <param name="lockToken"></param>
/// <returns>The asynchronous operation.</returns>
protected virtual async Task OnAbandonAsync(string lockToken)
{
IEnumerable<Guid> lockTokens = new[] { new Guid(lockToken) };
@ -989,9 +964,6 @@ namespace Microsoft.Azure.ServiceBus.Core
}
}
/// <summary></summary>
/// <param name="lockToken"></param>
/// <returns>The asynchronous operation.</returns>
protected virtual async Task OnDeferAsync(string lockToken)
{
IEnumerable<Guid> lockTokens = new[] { new Guid(lockToken) };
@ -1001,13 +973,10 @@ namespace Microsoft.Azure.ServiceBus.Core
}
else
{
await this.DisposeMessagesAsync(lockTokens, new Modified() { UndeliverableHere = true }).ConfigureAwait(false);
await this.DisposeMessagesAsync(lockTokens, new Modified { UndeliverableHere = true }).ConfigureAwait(false);
}
}
/// <summary></summary>
/// <param name="lockToken"></param>
/// <returns>The asynchronous operation.</returns>
protected virtual async Task OnDeadLetterAsync(string lockToken)
{
IEnumerable<Guid> lockTokens = new[] { new Guid(lockToken) };
@ -1021,9 +990,6 @@ namespace Microsoft.Azure.ServiceBus.Core
}
}
/// <summary></summary>
/// <param name="lockToken"></param>
/// <returns>The asynchronour operation.</returns>
protected virtual async Task<DateTime> OnRenewLockAsync(string lockToken)
{
DateTime lockedUntilUtc = DateTime.MinValue;
@ -1294,8 +1260,7 @@ namespace Microsoft.Azure.ServiceBus.Core
endPointAddress,
endPointAddress.AbsoluteUri,
claims,
linkDetails.Item2,
this.ClientId);
linkDetails.Item2);
this.clientLinkManager.SetActiveSendReceiveLink(activeSendReceiveClientLink);

Просмотреть файл

@ -525,8 +525,7 @@ namespace Microsoft.Azure.ServiceBus.Core
endPointAddress,
endPointAddress.AbsoluteUri,
claims,
linkDetails.Item2,
this.ClientId);
linkDetails.Item2);
this.clientLinkManager.SetActiveSendReceiveLink(activeSendReceiveClientLink);

Просмотреть файл

@ -42,7 +42,6 @@ namespace Microsoft.Azure.ServiceBus
/// </summary>
/// <param name="topicPath">The name of the topic, including slashes.</param>
/// <param name="subscriptionName">The name of the subscription.</param>
/// <returns></returns>
public static string FormatSubscriptionPath(string topicPath, string subscriptionName)
{
return string.Concat(topicPath, PathDelimiter, Subscriptions, PathDelimiter, subscriptionName);

Просмотреть файл

@ -21,7 +21,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// Initializes a new DataContractBinarySerializer instance
/// </summary>
/// <param name="type"></param>
public DataContractBinarySerializer(Type type)
{
this.dataContractSerializer = new DataContractSerializer(type);
@ -30,9 +29,8 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// Converts from stream to the corresponding object
/// </summary>
/// <param name="stream"></param>
/// <returns>Object corresponding to the stream</returns>
// <remarks>Override the default (Text) and use Binary Xml Reader instead</remarks>
/// <remarks>Override the default (Text) and use Binary Xml Reader instead</remarks>
public override object ReadObject(Stream stream)
{
return this.ReadObject(XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max));
@ -41,8 +39,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// Serializes the object into the stream
/// </summary>
/// <param name="stream"></param>
/// <param name="graph"></param>
/// <remarks>Override the default (Text) and use Binary Xml Reader instead</remarks>
public override void WriteObject(Stream stream, object graph)
{
@ -59,8 +55,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// Serializes the object into the stream using the XmlDictionaryWriter
/// </summary>
/// <param name="writer"></param>
/// <param name="graph"></param>
public override void WriteObject(XmlDictionaryWriter writer, object graph)
{
if (writer == null)
@ -74,8 +68,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// This method simply delegates to the DataContractSerializer implementation
/// </summary>
/// <param name="reader"></param>
/// <returns></returns>
public override bool IsStartObject(XmlDictionaryReader reader)
{
return this.dataContractSerializer.IsStartObject(reader);
@ -84,9 +76,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// This method simply delegates to the DataContractSerializer implementation
/// </summary>
/// <param name="reader"></param>
/// <param name="verifyObjectName"></param>
/// <returns></returns>
public override object ReadObject(XmlDictionaryReader reader, bool verifyObjectName)
{
return this.dataContractSerializer.ReadObject(reader, verifyObjectName);
@ -95,7 +84,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// This method simply delegates to the DataContractSerializer implementation
/// </summary>
/// <param name="writer"></param>
public override void WriteEndObject(XmlDictionaryWriter writer)
{
this.dataContractSerializer.WriteEndObject(writer);
@ -104,8 +92,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// This method simply delegates to the DataContractSerializer implementation
/// </summary>
/// <param name="writer"></param>
/// <param name="graph"></param>
public override void WriteObjectContent(XmlDictionaryWriter writer, object graph)
{
this.dataContractSerializer.WriteObjectContent(writer, graph);
@ -114,8 +100,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// This method simply delegates to the DataContractSerializer implementation
/// </summary>
/// <param name="writer"></param>
/// <param name="graph"></param>
public override void WriteStartObject(XmlDictionaryWriter writer, object graph)
{
this.dataContractSerializer.WriteStartObject(writer, graph);
@ -125,7 +109,6 @@ namespace Microsoft.Azure.ServiceBus.InteropExtensions
/// <summary>
/// Returns a static <see cref="DataContractBinarySerializer"/> instance of type T
/// </summary>
/// <typeparam name="T"></typeparam>
public static class DataContractBinarySerializer<T>
{
/// <summary>

Просмотреть файл

@ -32,7 +32,6 @@ namespace Microsoft.Azure.ServiceBus
/// <summary>
/// Closes the Client. Closes the connections opened by it.
/// </summary>
/// <returns>The asynchronous operation</returns>
Task CloseAsync();
/// <summary>

Просмотреть файл

@ -46,7 +46,6 @@ namespace Microsoft.Azure.ServiceBus
/// Set a custom state on the session which can be later retrieved using <see cref="GetStateAsync"/>
/// </summary>
/// <param name="sessionState">A byte array of session state</param>
/// <returns>The asynchronous operation</returns>
/// <remarks>This state is stored on Service Bus forever unless you set an empty state on it.</remarks>
Task SetStateAsync(byte[] sessionState);
@ -63,7 +62,6 @@ namespace Microsoft.Azure.ServiceBus
/// Renewal of session renews all the messages in the session as well. Each individual message need not be renewed.
/// </para>
/// </remarks>
/// <returns>The asynchronous operation.</returns>
Task RenewSessionLockAsync();
}
}

Просмотреть файл

@ -2,16 +2,13 @@
<PropertyGroup>
<Description>This is the next generation Azure Service Bus .NET Standard client library that focuses on queues &amp; topics. For more information about Service Bus, see https://azure.microsoft.com/en-us/services/service-bus/</Description>
<AssemblyTitle>Microsoft.Azure.ServiceBus</AssemblyTitle>
<VersionPrefix>1.0.0</VersionPrefix>
<Authors>Microsoft</Authors>
<TargetFrameworks>net451;netstandard1.3;uap10.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AssemblyName>Microsoft.Azure.ServiceBus</AssemblyName>
<AssemblyOriginatorKeyFile>../../build/keyfile.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Microsoft.Azure.ServiceBus</PackageId>
<PackageTags>Azure;Service Bus;ServiceBus;.NET;AMQP;IoT;Queue;Topic</PackageTags>
<PackageReleaseNotes>https://github.com/Azure/azure-service-bus-dotnet/releases</PackageReleaseNotes>
<PackageIconUrl>https://raw.githubusercontent.com/Azure/azure-service-bus-dotnet/master/service-bus.png</PackageIconUrl>
@ -25,8 +22,9 @@
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Microsoft.Azure.ServiceBus.xml</DocumentationFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>7</LangVersion>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>
<Target Name="IncludePDBsInPackage">

Просмотреть файл

@ -17,7 +17,6 @@ namespace Microsoft.Azure.ServiceBus
/// <param name="remainingTime">The remaining time before the timeout expires.</param>
/// <param name="currentRetryCount">The number of attempts that have been processed.</param>
/// <param name="retryInterval">The amount of time to delay before retry.</param>
/// <returns></returns>
protected override bool OnShouldRetry(
TimeSpan remainingTime,
int currentRetryCount,

Просмотреть файл

@ -40,8 +40,7 @@ namespace Microsoft.Azure.ServiceBus.Primitives
static string GetAssemblyAttributeValue<T>(Assembly assembly, Func<T, string> getter) where T : Attribute
{
var attribute = assembly.GetCustomAttribute(typeof(T)) as T;
return attribute == null ? null : getter(attribute);
return !(assembly.GetCustomAttribute(typeof(T)) is T attribute) ? null : getter(attribute);
}
}
}

Просмотреть файл

@ -109,7 +109,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
get { return this.token; }
}
/// <summary></summary>
protected virtual string ExpiresOnFieldName
{
get
@ -118,7 +117,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
}
}
/// <summary></summary>
protected virtual string AudienceFieldName
{
get
@ -127,7 +125,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
}
}
/// <summary></summary>
protected virtual string KeyValueSeparator
{
get
@ -136,7 +133,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
}
}
/// <summary></summary>
protected virtual string PairSeparator
{
get

Просмотреть файл

@ -43,12 +43,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
{
}
/// <summary></summary>
/// <param name="keyName"></param>
/// <param name="sharedAccessKey"></param>
/// <param name="customKeyEncoder"></param>
/// <param name="tokenTimeToLive"></param>
/// <param name="tokenScope"></param>
protected SharedAccessSignatureTokenProvider(string keyName, string sharedAccessKey, Func<string, byte[]> customKeyEncoder, TimeSpan tokenTimeToLive, TokenScope tokenScope)
: base(tokenScope)
{
@ -83,11 +77,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
TokenProvider.MessagingTokenProviderKeyEncoder(sharedAccessKey);
}
/// <summary></summary>
/// <param name="appliesTo"></param>
/// <param name="action"></param>
/// <param name="timeout"></param>
/// <returns></returns>
protected override Task<SecurityToken> OnGetTokenAsync(string appliesTo, string action, TimeSpan timeout)
{
string tokenString = this.BuildSignature(appliesTo);
@ -95,9 +84,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
return Task.FromResult<SecurityToken>(securityToken);
}
/// <summary></summary>
/// <param name="targetUri"></param>
/// <returns></returns>
protected virtual string BuildSignature(string targetUri)
{
return string.IsNullOrWhiteSpace(this.sharedAccessSignature)

Просмотреть файл

@ -10,10 +10,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
static class StringUtility
{
public static string GetRandomString()
{
return Guid.NewGuid().ToString().Substring(0, 6);
}
public static string GetFormattedLockTokens(IEnumerable<string> lockTokens)
{

Просмотреть файл

@ -16,14 +16,11 @@ namespace Microsoft.Azure.ServiceBus.Primitives
internal static readonly Func<string, byte[]> MessagingTokenProviderKeyEncoder = Encoding.UTF8.GetBytes;
const TokenScope DefaultTokenScope = TokenScope.Entity;
/// <summary></summary>
protected TokenProvider()
: this(TokenProvider.DefaultTokenScope)
{
}
/// <summary></summary>
/// <param name="tokenScope"></param>
protected TokenProvider(TokenScope tokenScope)
{
this.TokenScope = tokenScope;
@ -35,7 +32,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
/// </summary>
public TokenScope TokenScope { get; }
/// <summary></summary>
protected object ThisLock { get; }
/// <summary>
@ -107,7 +103,6 @@ namespace Microsoft.Azure.ServiceBus.Primitives
/// <param name="appliesTo">The URI which the access token applies to</param>
/// <param name="action">The request action</param>
/// <param name="timeout">The time span that specifies the timeout value for the message that gets the security token</param>
/// <returns></returns>
public Task<SecurityToken> GetTokenAsync(string appliesTo, string action, TimeSpan timeout)
{
TimeoutHelper.ThrowIfNegativeArgument(timeout);
@ -115,16 +110,8 @@ namespace Microsoft.Azure.ServiceBus.Primitives
return this.OnGetTokenAsync(appliesTo, action, timeout);
}
/// <summary></summary>
/// <param name="appliesTo"></param>
/// <param name="action"></param>
/// <param name="timeout"></param>
/// <returns></returns>
protected abstract Task<SecurityToken> OnGetTokenAsync(string appliesTo, string action, TimeSpan timeout);
/// <summary></summary>
/// <param name="appliesTo"></param>
/// <returns></returns>
protected virtual string NormalizeAppliesTo(string appliesTo)
{
return ServiceBusUriHelper.NormalizeUri(appliesTo, "http", true, stripPath: this.TokenScope == TokenScope.Namespace, ensureTrailingSlash: true);

Просмотреть файл

@ -323,7 +323,6 @@ namespace Microsoft.Azure.ServiceBus
/// only when <see cref="ReceiveMode"/> is set to <see cref="ServiceBus.ReceiveMode.PeekLock"/>.
/// This operation can only be performed on messages that were received by this client.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public Task CompleteAsync(string lockToken)
{
this.ThrowIfClosed();
@ -340,7 +339,6 @@ namespace Microsoft.Azure.ServiceBus
/// This operation can only be performed on messages that were received by this client.
/// </remarks>
/// This operation can only be performed on messages that were received by this client.
/// <returns>The asynchronous operation.</returns>
public Task AbandonAsync(string lockToken)
{
this.ThrowIfClosed();
@ -358,7 +356,6 @@ namespace Microsoft.Azure.ServiceBus
/// You can use <see cref="EntityNameHelper.FormatDeadLetterPath(string)"/> to help with this.
/// This operation can only be performed on messages that were received by this client.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public Task DeadLetterAsync(string lockToken)
{
this.ThrowIfClosed();
@ -467,8 +464,6 @@ namespace Microsoft.Azure.ServiceBus
this.InnerReceiver.UnregisterPlugin(serviceBusPluginName);
}
/// <summary></summary>
/// <returns></returns>
protected override async Task OnClosingAsync()
{
if (this.innerSender != null)

Просмотреть файл

@ -77,7 +77,6 @@ namespace Microsoft.Azure.ServiceBus
/// <param name="remainingTime">The remaining time before the timeout expires.</param>
/// <param name="currentRetryCount">The number of attempts that have been processed.</param>
/// <param name="retryInterval">The amount of time to delay before retry.</param>
/// <returns></returns>
protected override bool OnShouldRetry(TimeSpan remainingTime, int currentRetryCount, out TimeSpan retryInterval)
{
if (currentRetryCount > this.MaxRetryCount)

Просмотреть файл

@ -27,7 +27,6 @@ namespace Microsoft.Azure.ServiceBus
// This is a volatile copy of IsServerBusy. IsServerBusy is synchronized with a lock, whereas encounteredServerBusy is kept volatile for performance reasons.
volatile bool encounteredServerBusy;
/// <summary></summary>
protected RetryPolicy()
{
this.serverBusyResetTimer = new Timer(OnTimerCallback, this, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
@ -111,7 +110,6 @@ namespace Microsoft.Azure.ServiceBus
/// <summary>
/// Determines whether or not the exception can be retried.
/// </summary>
/// <param name="exception"></param>
/// <returns>A bool indicating whether or not the operation can be retried.</returns>
public virtual bool IsRetryableException(Exception exception)
{
@ -187,11 +185,6 @@ namespace Microsoft.Azure.ServiceBus
}
}
/// <summary></summary>
/// <param name="remainingTime"></param>
/// <param name="currentRetryCount"></param>
/// <param name="retryInterval"></param>
/// <returns></returns>
protected abstract bool OnShouldRetry(TimeSpan remainingTime, int currentRetryCount, out TimeSpan retryInterval);
static void OnTimerCallback(object state)

Просмотреть файл

@ -10,16 +10,11 @@ namespace Microsoft.Azure.ServiceBus
/// </summary>
public class ServiceBusCommunicationException : ServiceBusException
{
/// <summary></summary>
/// <param name="message"></param>
protected internal ServiceBusCommunicationException(string message)
: this(message, null)
{
}
/// <summary></summary>
/// <param name="message"></param>
/// <param name="innerException"></param>
protected internal ServiceBusCommunicationException(string message, Exception innerException)
: base(true, message, innerException)
{

Просмотреть файл

@ -305,8 +305,6 @@ namespace Microsoft.Azure.ServiceBus
}
}
/// <summary></summary>
/// <returns>The asynchronous operation.</returns>
protected override async Task OnClosingAsync()
{
if (this.ownsConnection)

Просмотреть файл

@ -275,7 +275,6 @@ namespace Microsoft.Azure.ServiceBus
/// only when <see cref="ReceiveMode"/> is set to <see cref="ServiceBus.ReceiveMode.PeekLock"/>.
/// This operation can only be performed on messages that were received by this client.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public Task CompleteAsync(string lockToken)
{
this.ThrowIfClosed();
@ -291,7 +290,6 @@ namespace Microsoft.Azure.ServiceBus
/// Abandoning a message will increase the delivery count on the message.
/// This operation can only be performed on messages that were received by this client.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public Task AbandonAsync(string lockToken)
{
this.ThrowIfClosed();
@ -309,7 +307,6 @@ namespace Microsoft.Azure.ServiceBus
/// You can use <see cref="EntityNameHelper.FormatDeadLetterPath(string)"/> to help with this.
/// This operation can only be performed on messages that were received by this client.
/// </remarks>
/// <returns>The asynchronous operation.</returns>
public Task DeadLetterAsync(string lockToken)
{
this.ThrowIfClosed();
@ -509,8 +506,6 @@ namespace Microsoft.Azure.ServiceBus
this.InnerSubscriptionClient.InnerReceiver.UnregisterPlugin(serviceBusPluginName);
}
/// <summary></summary>
/// <returns></returns>
protected override async Task OnClosingAsync()
{
if (this.innerSubscriptionClient != null)

Просмотреть файл

@ -203,8 +203,6 @@ namespace Microsoft.Azure.ServiceBus
this.InnerSender.UnregisterPlugin(serviceBusPluginName);
}
/// <summary></summary>
/// <returns></returns>
protected override async Task OnClosingAsync()
{
if (this.innerSender != null)

Просмотреть файл

@ -82,7 +82,7 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
{
var messageId = "test-message1";
var sessionId = Guid.NewGuid().ToString();
await sender.SendAsync(new Message() { MessageId = messageId, SessionId = sessionId });
await sender.SendAsync(new Message { MessageId = messageId, SessionId = sessionId });
TestUtility.Log($"Sent Message: {messageId} to Session: {sessionId}");
var sessionReceiver = await sessionClient.AcceptMessageSessionAsync(sessionId);
@ -147,7 +147,7 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
{
var messageId = "test-message1";
var sessionId = Guid.NewGuid().ToString();
await sender.SendAsync(new Message() { MessageId = messageId, SessionId = sessionId });
await sender.SendAsync(new Message { MessageId = messageId, SessionId = sessionId });
TestUtility.Log($"Sent Message: {messageId} to Session: {sessionId}");
sessionReceiver = await sessionClient.AcceptMessageSessionAsync(sessionId);

Просмотреть файл

@ -1,20 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>Microsoft.Azure.ServiceBus.UnitTests</AssemblyTitle>
<TargetFrameworks>netcoreapp1.0;net46</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AssemblyName>Microsoft.Azure.ServiceBus.UnitTests</AssemblyName>
<AssemblyOriginatorKeyFile>../../build/keyfile.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Microsoft.Azure.ServiceBus.UnitTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net46+win8</PackageTargetFallback>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -22,25 +22,25 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnMessagePeekLockWithAutoCompleteTrue(string queueName, int maxConcurrentCalls)
Task OnMessagePeekLockWithAutoCompleteTrue(string queueName, int maxConcurrentCalls)
{
await this.OnMessageTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
return this.OnMessageTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
}
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnMessagePeekLockWithAutoCompleteFalse(string queueName, int maxConcurrentCalls)
Task OnMessagePeekLockWithAutoCompleteFalse(string queueName, int maxConcurrentCalls)
{
await this.OnMessageTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, false);
return this.OnMessageTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, false);
}
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnMessageReceiveDelete(string queueName, int maxConcurrentCalls)
Task OnMessageReceiveDelete(string queueName, int maxConcurrentCalls)
{
await this.OnMessageTestAsync(queueName, maxConcurrentCalls, ReceiveMode.ReceiveAndDelete, false);
return this.OnMessageTestAsync(queueName, maxConcurrentCalls, ReceiveMode.ReceiveAndDelete, false);
}
[Theory]

Просмотреть файл

@ -20,17 +20,17 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnMessagePeekLockWithAutoCompleteTrue(string topicName, int maxConcurrentCalls)
Task OnMessagePeekLockWithAutoCompleteTrue(string topicName, int maxConcurrentCalls)
{
await this.OnMessageTestAsync(topicName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
return this.OnMessageTestAsync(topicName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
}
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnMessageReceiveDelete(string topicName, int maxConcurrentCalls)
Task OnMessageReceiveDelete(string topicName, int maxConcurrentCalls)
{
await this.OnMessageTestAsync(topicName, maxConcurrentCalls, ReceiveMode.ReceiveAndDelete, false);
return this.OnMessageTestAsync(topicName, maxConcurrentCalls, ReceiveMode.ReceiveAndDelete, false);
}
async Task OnMessageTestAsync(string topicName, int maxConcurrentCalls, ReceiveMode mode, bool autoComplete)

Просмотреть файл

@ -28,25 +28,25 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnSessionPeekLockWithAutoCompleteTrue(string queueName, int maxConcurrentCalls)
Task OnSessionPeekLockWithAutoCompleteTrue(string queueName, int maxConcurrentCalls)
{
await this.OnSessionTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
return this.OnSessionTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
}
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnSessionPeekLockWithAutoCompleteFalse(string queueName, int maxConcurrentCalls)
Task OnSessionPeekLockWithAutoCompleteFalse(string queueName, int maxConcurrentCalls)
{
await this.OnSessionTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, false);
return this.OnSessionTestAsync(queueName, maxConcurrentCalls, ReceiveMode.PeekLock, false);
}
[Theory]
[MemberData(nameof(PartitionedNonPartitionedTestPermutations))]
[DisplayTestMethodName]
async Task OnSessionReceiveDelete(string queueName, int maxConcurrentCalls)
Task OnSessionReceiveDelete(string queueName, int maxConcurrentCalls)
{
await this.OnSessionTestAsync(queueName, maxConcurrentCalls, ReceiveMode.ReceiveAndDelete, false);
return this.OnSessionTestAsync(queueName, maxConcurrentCalls, ReceiveMode.ReceiveAndDelete, false);
}
[Fact]

Просмотреть файл

@ -24,17 +24,17 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnSessionPeekLockWithAutoCompleteTrue(string topicName, int maxConcurrentCalls)
Task OnSessionPeekLockWithAutoCompleteTrue(string topicName, int maxConcurrentCalls)
{
await this.OnSessionTestAsync(topicName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
return this.OnSessionTestAsync(topicName, maxConcurrentCalls, ReceiveMode.PeekLock, true);
}
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task OnSessionPeekLockWithAutoCompleteFalse(string topicName, int maxConcurrentCalls)
Task OnSessionPeekLockWithAutoCompleteFalse(string topicName, int maxConcurrentCalls)
{
await this.OnSessionTestAsync(topicName, maxConcurrentCalls, ReceiveMode.PeekLock, false);
return this.OnSessionTestAsync(topicName, maxConcurrentCalls, ReceiveMode.PeekLock, false);
}
[Fact]

Просмотреть файл

@ -15,7 +15,7 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
{
[Fact]
[DisplayTestMethodName]
async Task Registering_plugin_multiple_times_should_throw()
Task Registering_plugin_multiple_times_should_throw()
{
var messageReceiver = new MessageReceiver(TestUtility.NamespaceConnectionString, TestConstants.NonPartitionedQueueName, ReceiveMode.ReceiveAndDelete);
var firstPlugin = new FirstSendPlugin();
@ -23,19 +23,19 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
messageReceiver.RegisterPlugin(firstPlugin);
Assert.Throws<ArgumentException>(() => messageReceiver.RegisterPlugin(secondPlugin));
await messageReceiver.CloseAsync();
return messageReceiver.CloseAsync();
}
[Fact]
[DisplayTestMethodName]
async Task Unregistering_plugin_should_complete_with_plugin_set()
Task Unregistering_plugin_should_complete_with_plugin_set()
{
var messageReceiver = new MessageReceiver(TestUtility.NamespaceConnectionString, TestConstants.NonPartitionedQueueName, ReceiveMode.ReceiveAndDelete);
var firstPlugin = new FirstSendPlugin();
messageReceiver.RegisterPlugin(firstPlugin);
messageReceiver.UnregisterPlugin(firstPlugin.Name);
await messageReceiver.CloseAsync();
return messageReceiver.CloseAsync();
}
[Fact]

Просмотреть файл

@ -1,24 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
using System.Runtime.InteropServices;
using Xunit;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft.Azure.ServiceBus.UnitTests")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bda98e20-3a26-4a5a-9371-cb02b73e3434")]
[assembly: CollectionBehavior(DisableTestParallelization = true)]

Просмотреть файл

@ -30,12 +30,12 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
{
var messageId1 = "test-message1";
var sessionId1 = "sessionId1";
await sender.SendAsync(new Message() { MessageId = messageId1, SessionId = sessionId1 }).ConfigureAwait(false);
await sender.SendAsync(new Message { MessageId = messageId1, SessionId = sessionId1 }).ConfigureAwait(false);
TestUtility.Log($"Sent Message: {messageId1} to Session: {sessionId1}");
var messageId2 = "test-message2";
var sessionId2 = "sessionId2";
await sender.SendAsync(new Message() { MessageId = messageId2, SessionId = sessionId2 }).ConfigureAwait(false);
await sender.SendAsync(new Message { MessageId = messageId2, SessionId = sessionId2 }).ConfigureAwait(false);
TestUtility.Log($"Sent Message: {messageId2} to Session: {sessionId2}");
// Receive Message, Complete and Close with SessionId - sessionId 1
@ -47,7 +47,7 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
// Receive Message, Complete and Close - With Null SessionId specified
var messageId3 = "test-message3";
var sessionId3 = "sessionId3";
await sender.SendAsync(new Message() { MessageId = messageId3, SessionId = sessionId3 }).ConfigureAwait(false);
await sender.SendAsync(new Message { MessageId = messageId3, SessionId = sessionId3 }).ConfigureAwait(false);
await this.AcceptAndCompleteSessionsAsync(sessionClient, null, messageId3).ConfigureAwait(false);
}
@ -71,7 +71,7 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
{
var messageId = "test-message1";
var sessionId = Guid.NewGuid().ToString();
await sender.SendAsync(new Message()
await sender.SendAsync(new Message
{
MessageId = messageId,
SessionId = sessionId
@ -129,7 +129,7 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
{
var messageId = "test-message1";
var sessionId = Guid.NewGuid().ToString();
await sender.SendAsync(new Message() { MessageId = messageId, SessionId = sessionId });
await sender.SendAsync(new Message { MessageId = messageId, SessionId = sessionId });
TestUtility.Log($"Sent Message: {messageId} to Session: {sessionId}");
var sessionReceiver = await sessionClient.AcceptMessageSessionAsync(sessionId);
@ -182,12 +182,12 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
{
var messageId1 = "test-message1";
var sessionId1 = "sessionId1";
await sender.SendAsync(new Message() { MessageId = messageId1, SessionId = sessionId1 });
await sender.SendAsync(new Message { MessageId = messageId1, SessionId = sessionId1 });
TestUtility.Log($"Sent Message: {messageId1} to Session: {sessionId1}");
var messageId2 = "test-message2";
var sessionId2 = "sessionId2";
await sender.SendAsync(new Message() { MessageId = messageId2, SessionId = sessionId2 });
await sender.SendAsync(new Message { MessageId = messageId2, SessionId = sessionId2 });
TestUtility.Log($"Sent Message: {messageId2} to Session: {sessionId2}");
// Peek Message, Receive and Delete with SessionId - sessionId 1

Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
[assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)]