Skip to content

Commit

Permalink
run dotnet format (#537)
Browse files Browse the repository at this point in the history
run `dotnet format`
  • Loading branch information
AnthonySteele authored Apr 12, 2019
1 parent ec973a8 commit 5e24a34
Show file tree
Hide file tree
Showing 49 changed files with 80 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void GivenASubscriptionToAQueueInTwoRegions(string primaryRegion, string
handler.Handle(Arg.Any<SimpleMessage>()).Returns(true);
handler
.When(x => x.Handle(Arg.Any<SimpleMessage>()))
.Do(async x => await _handler.Complete((SimpleMessage) x.Args()[0]));
.Do(async x => await _handler.Complete((SimpleMessage)x.Args()[0]));

_subscriber = CreateMeABus
.WithLogging(LoggerFactory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void GivenASubscriptionToAQueueInTwoRegions(string primaryRegion, string
handler.Handle(Arg.Any<SimpleMessage>()).Returns(true);
handler
.When(x => x.Handle(Arg.Any<SimpleMessage>()))
.Do(async x => await _handler.Complete((SimpleMessage) x.Args()[0]));
.Do(async x => await _handler.Complete((SimpleMessage)x.Args()[0]));

_subscriber = CreateMeABus
.WithLogging(LoggerFactory)
Expand Down
2 changes: 1 addition & 1 deletion JustSaying.Models/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected Message()
public Guid Id { get; set; }
public DateTime TimeStamp { get; set; }
public string RaisingComponent { get; set; }
public string Version{ get; private set; }
public string Version { get; private set; }
public string SourceIp { get; private set; }
public string Tenant { get; set; }
public string Conversation { get; set; }
Expand Down
8 changes: 4 additions & 4 deletions JustSaying.Tools/CommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ await CommandLine
private static void InitializeCommandLineParser(ICommandLineElementParser<ICommand> x)
{
x.Add((from arg in x.Argument("exit")
select (ICommand) new ExitCommand())
select (ICommand)new ExitCommand())
.Or(from arg in x.Argument("quit")
select (ICommand) new ExitCommand())
select (ICommand)new ExitCommand())
.Or(from arg in x.Argument("help")
select (ICommand) new HelpCommand())
select (ICommand)new HelpCommand())

.Or(from arg in x.Argument("move")
from sourceQueueName in x.Definition("from")
from destinationQueueName in x.Definition("to")
from region in x.Definition("in")
from count in (from d in x.Definition("count") select d).Optional("count", "1")
select (ICommand) new MoveCommand(sourceQueueName.Value, destinationQueueName.Value, region.Value,
select (ICommand)new MoveCommand(sourceQueueName.Value, destinationQueueName.Value, region.Value,
int.Parse(count.Value, CultureInfo.InvariantCulture)))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ExactlyOnceReaderTests
[Fact]
public void ObjectTypeDoesNotHaveExactlyOnce()
{
var reader = new ExactlyOnceReader(typeof (object));
var reader = new ExactlyOnceReader(typeof(object));

reader.Enabled.ShouldBeFalse();
}
Expand All @@ -25,7 +25,7 @@ public void UnadornedHandlerType_DoesNotHaveExactlyOnce()
[Fact]
public void OnceTestHandlerAsyncType_HasExactlyOnce()
{
var reader = new ExactlyOnceReader(typeof (OnceTestHandlerAsync));
var reader = new ExactlyOnceReader(typeof(OnceTestHandlerAsync));

reader.Enabled.ShouldBeTrue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void EmptyMapReturnsNullHandlers()
public void HandlerIsReturnedForMatchingType()
{
var map = new HandlerMap();
map.Add(typeof(SimpleMessage), m => Task.FromResult(true) );
map.Add(typeof(SimpleMessage), m => Task.FromResult(true));

var handler = map.Get(typeof(SimpleMessage));

Expand Down Expand Up @@ -72,7 +72,7 @@ public void CorrectHandlerIsReturnedForType()
var handler1 = map.Get(typeof(SimpleMessage));

handler1.ShouldBe(fn1);

var handler2 = map.Get(typeof(AnotherSimpleMessage));

handler2.ShouldBe(fn2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task DifferentThreadsHaveDifferentContexts()
var data2 = MakeUniqueMessageContext();

var t1 = Task.Run(async () => await ThreadLocalDataRemainsTheSame(data1));
var t2 = Task.Run(async () => await ThreadLocalDataRemainsTheSame(data2));
var t2 = Task.Run(async () => await ThreadLocalDataRemainsTheSame(data2));

await Task.WhenAll(t1, t2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected virtual void Given()
_serializationRegister.DeserializeMessage(Arg.Any<string>()).Returns(_typedMessage);
}

private async Task When() => await SystemUnderTest.DispatchMessage(_sqsMessage, CancellationToken.None);
private async Task When() => await SystemUnderTest.DispatchMessage(_sqsMessage, CancellationToken.None);

private MessageDispatcher CreateSystemUnderTestAsync()
{
Expand Down Expand Up @@ -144,7 +144,7 @@ public void ShouldInvokeMessageBackoffStrategyWithNumberOfReceives()
[Fact]
public void ShouldUpdateMessageVisibility()
{
_amazonSqsClient.Received(1).ChangeMessageVisibilityAsync(Arg.Is<ChangeMessageVisibilityRequest>(x => x.QueueUrl == ExpectedQueueUrl && x.ReceiptHandle == _sqsMessage.ReceiptHandle && x.VisibilityTimeout == (int) _expectedBackoffTimeSpan.TotalSeconds));
_amazonSqsClient.Received(1).ChangeMessageVisibilityAsync(Arg.Is<ChangeMessageVisibilityRequest>(x => x.QueueUrl == ExpectedQueueUrl && x.ReceiptHandle == _sqsMessage.ReceiptHandle && x.VisibilityTimeout == (int)_expectedBackoffTimeSpan.TotalSeconds));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public async Task ReturnedFunctionIsCallable()
mockHandler.Handle(Arg.Any<SimpleMessage>()).Returns(true);

// act
var wrapped = handlerWrapper.WrapMessageHandler(() => mockHandler);
var wrapped = handlerWrapper.WrapMessageHandler(() => mockHandler);

var result = await wrapped(new SimpleMessage());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public virtual Task DisposeAsync()
protected abstract void Given();
protected abstract Task<SnsTopicByName> CreateSystemUnderTestAsync();

protected abstract Task WhenAsync();
protected abstract Task WhenAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override async Task<SqsPublisher> CreateSystemUnderTestAsync()
protected override void Given()
{
Sqs.GetQueueUrlAsync(Arg.Any<string>())
.Returns(new GetQueueUrlResponse {QueueUrl = Url});
.Returns(new GetQueueUrlResponse { QueueUrl = Url });

Sqs.GetQueueAttributesAsync(Arg.Any<GetQueueAttributesRequest>())
.Returns(new GetQueueAttributesResponse());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ protected override async Task<SqsPublisher> CreateSystemUnderTestAsync()

protected override void Given()
{
Sqs.GetQueueUrlAsync(Arg.Any<string>())
.Returns(new GetQueueUrlResponse { QueueUrl = Url });
Sqs.GetQueueUrlAsync(Arg.Any<string>())
.Returns(new GetQueueUrlResponse { QueueUrl = Url });

Sqs.GetQueueAttributesAsync(Arg.Any<GetQueueAttributesRequest>())
.Returns(new GetQueueAttributesResponse());
Sqs.GetQueueAttributesAsync(Arg.Any<GetQueueAttributesRequest>())
.Returns(new GetQueueAttributesResponse());

_serializationRegister.Serialize(_message, false)
.Returns("serialized_contents");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public virtual Task DisposeAsync()
protected abstract void Given();
protected abstract Task<SqsPublisher> CreateSystemUnderTestAsync();

protected abstract Task WhenAsync();
protected abstract Task WhenAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task<bool> Handle(T message)
{
return await _inner.Handle(message);
}
finally
finally
{
TaskHelpers.DelaySendDone(_doneSignal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class WhenAttemptingToInterrogateASubscriber : BaseQueuePollingTest
public void SubscribedMessagesAreAddedToTheInterrogationDetails()
{
SystemUnderTest.Subscribers.Count.ShouldBe(1);
SystemUnderTest.Subscribers.First(x => x.MessageType == typeof (SimpleMessage)).ShouldNotBe(null);
SystemUnderTest.Subscribers.First(x => x.MessageType == typeof(SimpleMessage)).ShouldNotBe(null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ protected override void Given()
_expectedTimeout = 5;

var messageLockResponse = new MessageLockResponse
{
DoIHaveExclusiveLock = true
};
{
DoIHaveExclusiveLock = true
};

MessageLock = Substitute.For<IMessageLockAsync>();
MessageLock.TryAquireLockAsync(Arg.Any<string>(), Arg.Any<TimeSpan>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void Given()
Sqs.ReceiveMessageAsync(
Arg.Any<ReceiveMessageRequest>(),
Arg.Any<CancellationToken>())
.Returns(_ => ExceptionOnFirstCall());
.Returns(_ => ExceptionOnFirstCall());
}

private Task ExceptionOnFirstCall()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void Given()
Arg.Any<CancellationToken>())
.Returns(x => Task.FromResult(GenerateEmptyMessage()));

_sqs.When(x => x.ReceiveMessageAsync(
_sqs.When(x => x.ReceiveMessageAsync(
Arg.Any<ReceiveMessageRequest>(),
Arg.Any<CancellationToken>()))
.Do(x => _callCount++);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace JustSaying.UnitTests.AwsTools.QueueCreation
{
public class WhenSerializingRedrivePolicy
public class WhenSerializingRedrivePolicy
{
[Fact]
public void CanDeserializeIntoRedrivePolicy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace JustSaying.UnitTests.JustSayingBus
public class WhenPublishingMessageWithoutMonitor : GivenAServiceBusWithoutMonitoring
{
private readonly IMessagePublisher _publisher = Substitute.For<IMessagePublisher>();

protected override async Task WhenAsync()
{
SystemUnderTest.AddMessagePublisher<SimpleMessage>(_publisher, string.Empty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WhenRegisteringMessageHandlers : GivenAServiceBus
private string _region;
private Func<IHandlerAsync<Message>> _futureHandler1;
private Func<IHandlerAsync<Message2>> _futureHandler2;

protected override void Given()
{
base.Given();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override void Given()
});
_subscriber2 = Substitute.For<INotificationSubscriber>();
_subscriber2.Queue.Returns("queue2");
_subscriber2.Subscribers.Returns(new Collection<ISubscriber> {new Subscriber(typeof (SimpleMessage))});
_subscriber2.Subscribers.Returns(new Collection<ISubscriber> { new Subscriber(typeof(SimpleMessage)) });
}

protected override Task WhenAsync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected override Task WhenAsync()
[Fact]
public void ArgExceptionThrown()
{
((ArgumentException) ThrownException).ParamName.ShouldBe("region");
((ArgumentException)ThrownException).ParamName.ShouldBe("region");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class WhenUsingMultipleRegions : GivenAServiceBus
protected override void Given()
{
base.Given();
Config.Regions.Returns(new List<string>{"region1", "region2"});
Config.Regions.Returns(new List<string> { "region1", "region2" });
}

protected override Task WhenAsync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class WhenEnsuringMessageIsOnlyHandledExactlyOnce
public async Task WhenMessageIsLockedByAnotherHandler_MessageWillBeLeftInTheQueue()
{
var messageLock = Substitute.For<IMessageLockAsync>();
messageLock.TryAquireLockAsync(Arg.Any<string>(), Arg.Any<TimeSpan>()).Returns(new MessageLockResponse {DoIHaveExclusiveLock = false});
messageLock.TryAquireLockAsync(Arg.Any<string>(), Arg.Any<TimeSpan>()).Returns(new MessageLockResponse { DoIHaveExclusiveLock = false });
var sut = new ExactlyOnceHandler<OrderAccepted>(Substitute.For<IHandlerAsync<OrderAccepted>>(), messageLock, 1, "handlerName");

var result = await sut.Handle(new OrderAccepted());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task WhenHandlerIsWrappedinStopWatch_InnerHandlerIsCalled()

var result = await stopWatchHandler.Handle(new OrderAccepted());
result.ShouldBeTrue();

await handler.Received(1).Handle(Arg.Any<OrderAccepted>());
}

Expand All @@ -35,7 +35,7 @@ public async Task WhenHandlerIsWrappedinStopWatch_MonitoringIsCalled()

await stopWatchHandler.Handle(new OrderAccepted());

monitoring.Received(1). HandlerExecutionTime(
monitoring.Received(1).HandlerExecutionTime(
Arg.Any<Type>(), Arg.Any<Type>(), Arg.Any<TimeSpan>());
}

Expand Down Expand Up @@ -66,7 +66,7 @@ public async Task WhenHandlerIsWrappedinStopWatch_MonitoringIsCalledWithTiming()
await stopWatchHandler.Handle(new OrderAccepted());

monitoring.Received(1).HandlerExecutionTime(
Arg.Any<Type>(), Arg.Any<Type>(),
Arg.Any<Type>(), Arg.Any<Type>(),
Arg.Is<TimeSpan>(ts => ts > TimeSpan.Zero));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class WhenAskingForANewSerializer : XBehaviourTest<NewtonsoftSerializatio

protected override void Given()
{

}

protected override void WhenAction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void MessagesContainSameDetails()
_messageOut.RaisingComponent.ShouldBe(_messageIn.RaisingComponent);
_messageOut.TimeStamp.ShouldBe(_messageIn.TimeStamp);
}

[Fact]
public void EnumsAreRepresentedAsStrings()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void MessageHasBeenCreated()
public void EnumsAreNotRepresentedAsStrings()
{
_jsonMessage.ShouldContain("EnumVal");
_jsonMessage.ShouldNotContain("Two"); }
_jsonMessage.ShouldNotContain("Two");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override void WhenAction()
{
var messageSerializer = Substitute.For<IMessageSerializer>();
messageSerializer.GetMessageSubject(messageBody).Returns(typeof(CustomMessage).Name);
messageSerializer.Deserialize(messageBody, typeof (CustomMessage)).Returns(new CustomMessage());
messageSerializer.Deserialize(messageBody, typeof(CustomMessage)).Returns(new CustomMessage());
SystemUnderTest.AddSerializer<CustomMessage>(messageSerializer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace JustSaying.UnitTests.Messaging.Serialization.SubjectProviders
{
public class GenericMessageSubjectProviderTests
{
// these classes are never instantiated, but the types are used in tests
// these classes are never instantiated, but the types are used in tests
#pragma warning disable CA1812
class Foo { }

Expand Down
4 changes: 2 additions & 2 deletions JustSaying.UnitTests/XBehaviourTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected XBehaviourTest()

protected TSystemUnderTest SystemUnderTest { get; private set; }
protected Exception ThrownException { get; private set; }

protected virtual TSystemUnderTest CreateSystemUnderTest()
{
var fixture = new Fixture();
Expand All @@ -30,7 +30,7 @@ protected void Execute()
SystemUnderTest = CreateSystemUnderTest();
WhenAction();
}
catch (Exception ex) when(_recordThrownExceptions)
catch (Exception ex) when (_recordThrownExceptions)
{
ThrownException = ex;
}
Expand Down
2 changes: 1 addition & 1 deletion JustSaying/AwsTools/DefaultAwsClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public DefaultAwsClientFactory(AWSCredentials customCredentials)

public Uri ServiceUri { get; set; }

public IAmazonSimpleNotificationService GetSnsClient(RegionEndpoint region)
public IAmazonSimpleNotificationService GetSnsClient(RegionEndpoint region)
=> new AmazonSimpleNotificationServiceClient(_credentials, CreateSNSConfig(region));

public IAmazonSQS GetSqsClient(RegionEndpoint region)
Expand Down
4 changes: 2 additions & 2 deletions JustSaying/AwsTools/JustSayingConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class JustSayingConstants
/// Default visibility timeout for message
/// </summary>
public static TimeSpan DefaultVisibilityTimeout => TimeSpan.FromSeconds(30);

/// <summary>
/// Number of times a handler will retry a message until a message
/// is sent to error queue
Expand Down Expand Up @@ -49,7 +49,7 @@ public static class JustSayingConstants
/// Maximum message retention period on a queue.
/// </summary>
public static TimeSpan MaximumRetentionPeriod => TimeSpan.FromDays(14);

/// <summary>
/// Minimum delay in message delivery for SQS. This is also the default.
/// </summary>
Expand Down
Loading

0 comments on commit 5e24a34

Please sign in to comment.