Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/BuslyCLI.Console/Commands/Command/SendCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ await rawEndpoint.Dispatch(
new TransportTransaction()
);

// TODO: Figure out why this causes connection closed errors with rabbitmq
// await rawEndpoint.ShutDownAndCleanUp();
await rawEndpoint.ShutDownAndCleanUp();

return 0;
}
Expand Down
3 changes: 1 addition & 2 deletions src/BuslyCLI.Console/Commands/Event/PublishCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ await rawEndpoint.Dispatch(
new TransportTransaction()
);

// TODO: Figure out why this causes connection closed errors with rabbitmq
// await rawEndpoint.ShutDownAndCleanUp();
await rawEndpoint.ShutDownAndCleanUp();

return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// [TestCase("Error: Option 'destination-endpoint' is defined but no value has been provided.", "command", "send", "--content-type", "application/json", "--enclosed-message-type", "MessageContracts.Commands.CreateOrder", "--message-body", "test", "--destination-endpoint")]
// public async Task ShouldValidateRequiredOptions(string expectedSubstring, params string[] args)
// {
// var result = _sut.Run(args);
// var result = await _sut.RunAsync([args]);
//
// Assert.That(result.ExitCode, Is.Not.EqualTo(0));
// Assert.That(result.Output, Does.Contain(expectedSubstring), $"Expected output to contain: {expectedSubstring}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Setup()
}

[Test]
public void ShouldOutputCurrentTransport()
public async Task ShouldOutputCurrentTransport()
{
// Arrange
var yamlFile = """
Expand All @@ -37,7 +37,7 @@ public void ShouldOutputCurrentTransport()
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run("transport", "current", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "current", "--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand All @@ -48,7 +48,7 @@ public void ShouldOutputCurrentTransport()
));
}
[Test]
public void ShouldOutputCurrentTransportNotConfigured()
public async Task ShouldOutputCurrentTransportNotConfigured()
{
// Arrange
var yamlFile = """
Expand All @@ -62,7 +62,7 @@ public void ShouldOutputCurrentTransportNotConfigured()
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run("transport", "current", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "current", "--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Setup()
}

[Test]
public void ShouldBeIdempotentWhenDeletingNonExistingTransport()
public async Task ShouldBeIdempotentWhenDeletingNonExistingTransport()
{
// Arrange
var yamlFile = """
Expand All @@ -38,14 +38,14 @@ public void ShouldBeIdempotentWhenDeletingNonExistingTransport()
var nonExistingTransport = Guid.NewGuid().ToString();

// Act
var result = _sut.Run("transport", "delete", nonExistingTransport, "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "delete", nonExistingTransport, "--config", configFile.FilePath]);

Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.Output, Is.EqualTo($"Cannot delete transport {nonExistingTransport} since it doesn't exist in the config file."));
}

[Test]
public void ShouldDeleteTransport()
public async Task ShouldDeleteTransport()
{
// Arrange
var yamlFile = """
Expand All @@ -59,7 +59,7 @@ public void ShouldDeleteTransport()
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run("transport", "delete", "local-learning", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "delete", "local-learning", "--config", configFile.FilePath]);

Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.Output, Is.EqualTo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,35 @@ public void Setup()
}

[Test]
public void ShouldOutputAnEmptyGridWhenConfigFileIsEmptyYaml()
public async Task ShouldOutputAnEmptyGridWhenConfigFileIsEmptyYaml()
{
// Arrange
var yamlFile = """
---
""";
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);
var result = _sut.Run("transport", "list", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "list", "--config", configFile.FilePath]);

Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.Output, Is.EqualTo("CURRENT NAME TRANSPORT-TYPE"));
}

[Test]
public void ShouldOutputAnEmptyGridWhenTransportArrayIsEmpty()
public async Task ShouldOutputAnEmptyGridWhenTransportArrayIsEmpty()
{
// Arrange
var yamlFile = """
---
transports:
""";
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);
var result = _sut.Run("transport", "list", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "list", "--config", configFile.FilePath]);

Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.Output, Is.EqualTo("CURRENT NAME TRANSPORT-TYPE"));
}
[Test]
public void ShouldOutputASingleTransport()
public async Task ShouldOutputASingleTransport()
{
// Arrange
var yamlFile = """
Expand All @@ -65,7 +65,7 @@ public void ShouldOutputASingleTransport()
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run("transport", "list", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "list", "--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Setup()
}

[Test]
public void ShouldOutputAMessageWhenTransportDoesNotExist()
public async Task ShouldOutputAMessageWhenTransportDoesNotExist()
{
// Arrange
var yamlFile = """
Expand All @@ -38,7 +38,7 @@ public void ShouldOutputAMessageWhenTransportDoesNotExist()
var nonExistingTransport = $"{Guid.NewGuid():N}";

// Act
var result = _sut.Run("transport", "set", nonExistingTransport, "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "set", nonExistingTransport, "--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand All @@ -50,7 +50,7 @@ No transport exists with the name {nonExistingTransport}.
}

[Test]
public void ShouldOutputAMessageWhenTransportIsSet()
public async Task ShouldOutputAMessageWhenTransportIsSet()
{
// Arrange
var yamlFile = """
Expand All @@ -67,7 +67,7 @@ public void ShouldOutputAMessageWhenTransportIsSet()
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run("transport", "set", "local-learning2", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "set", "local-learning2", "--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand All @@ -79,7 +79,7 @@ Switched to transport "local-learning2".
}

[Test]
public void ShouldBeIdempotentWhenSettingTransportToTheAlreadyConfiguredTransport()
public async Task ShouldBeIdempotentWhenSettingTransportToTheAlreadyConfiguredTransport()
{
// Arrange
var yamlFile = """
Expand All @@ -93,7 +93,7 @@ public void ShouldBeIdempotentWhenSettingTransportToTheAlreadyConfiguredTranspor
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run("transport", "set", "local-learning", "--config", configFile.FilePath);
var result = await _sut.RunAsync(["transport", "set", "local-learning", "--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"command",
"send",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Commands.CreateOrder",
"--destination-endpoint", testEndpoint.EndpointName,
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down Expand Up @@ -93,13 +93,13 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"event",
"publish",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Events.OrderCreated",
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"command",
"send",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Commands.CreateOrder",
"--destination-endpoint", testEndpoint.EndpointName,
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down Expand Up @@ -99,13 +99,13 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"event",
"publish",
"--content-type", "application/json",
"--enclosed-message-type", eventType,
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"command",
"send",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Commands.CreateOrder",
"--destination-endpoint", testEndpoint.EndpointName,
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down Expand Up @@ -89,13 +89,13 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"event",
"publish",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Events.OrderCreated",
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"command",
"send",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Commands.CreateOrder",
"--destination-endpoint", testEndpoint.EndpointName,
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down Expand Up @@ -89,13 +89,13 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"event",
"publish",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Events.OrderCreated",
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"command",
"send",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Commands.CreateOrder",
"--destination-endpoint", testEndpoint.EndpointName,
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down Expand Up @@ -90,13 +90,13 @@ await RunWithTestEndpoint(async testEndpoint =>
using var configFile = new TestableNServiceBusConfigurationFile(yamlFile);

// Act
var result = _sut.Run(
var result = await _sut.RunAsync([
"event",
"publish",
"--content-type", "application/json",
"--enclosed-message-type", "MessageContracts.Events.OrderCreated",
"--message-body", json,
"--config", configFile.FilePath);
"--config", configFile.FilePath]);

// Assert
Assert.That(result.ExitCode, Is.EqualTo(0));
Expand Down
Loading
Loading