1+ using BuslyCLI . Console . Tests . TestHelpers ;
2+
3+ namespace BuslyCLI . Console . Tests . Commands . NsbTimeout ;
4+
5+ public class SendTimeoutTests : CommandTestBase
6+ {
7+ [ Test ]
8+ public void ShouldOutputAnErrorWhenTransportIsSqlServer ( )
9+ {
10+ // Arrange
11+ var yamlFile = """
12+ ---
13+ current-transport: local-sql-server
14+ transports:
15+ - name: local-sql-server
16+ sql-server-transport-config:
17+ connection-string: Server=localhost;Database=test;
18+ """ ;
19+ using var configFile = new TestableNServiceBusConfigurationFile ( yamlFile ) ;
20+
21+ // Act
22+ var result = Sut . Run (
23+ "timeout" , "send" ,
24+ "--content-type" , "application/json" ,
25+ "--enclosed-message-type" , "MessageContracts.Timeouts.OrderTimeout" ,
26+ "--destination-endpoint" , "Sales" ,
27+ "--message-body" , "{}" ,
28+ "--delay-delivery-with" , "00:00:01" ,
29+ "--config" , configFile . FilePath ) ;
30+
31+ // Assert
32+ Assert . That ( result . ExitCode , Is . EqualTo ( 1 ) ) ;
33+ Assert . That ( result . Output , Does . Contain ( "SqlServerTransport" ) ) ;
34+ Assert . That ( result . Output , Does . Contain ( "does not support sending timeouts" ) ) ;
35+ Assert . That ( result . Output , Does . Contain ( "https://tragiccode.com/busly-cli/docs/cli-reference/timeout/send" ) ) ;
36+ }
37+
38+ [ Test ]
39+ public void ShouldOutputAnErrorWhenTransportIsPostgreSql ( )
40+ {
41+ // Arrange
42+ var yamlFile = """
43+ ---
44+ current-transport: local-postgresql
45+ transports:
46+ - name: local-postgresql
47+ postgre-sql-transport-config:
48+ connection-string: Host=localhost;Database=test;
49+ """ ;
50+ using var configFile = new TestableNServiceBusConfigurationFile ( yamlFile ) ;
51+
52+ // Act
53+ var result = Sut . Run (
54+ "timeout" , "send" ,
55+ "--content-type" , "application/json" ,
56+ "--enclosed-message-type" , "MessageContracts.Timeouts.OrderTimeout" ,
57+ "--destination-endpoint" , "Sales" ,
58+ "--message-body" , "{}" ,
59+ "--delay-delivery-with" , "00:00:01" ,
60+ "--config" , configFile . FilePath ) ;
61+
62+ // Assert
63+ Assert . That ( result . ExitCode , Is . EqualTo ( 1 ) ) ;
64+ Assert . That ( result . Output , Does . Contain ( "PostgreSqlTransport" ) ) ;
65+ Assert . That ( result . Output , Does . Contain ( "does not support sending timeouts" ) ) ;
66+ Assert . That ( result . Output , Does . Contain ( "https://tragiccode.com/busly-cli/docs/cli-reference/timeout/send" ) ) ;
67+ }
68+
69+ [ Test ]
70+ public void ShouldOutputAnErrorWhenTransportIsAzureStorageQueues ( )
71+ {
72+ // Arrange
73+ var yamlFile = """
74+ ---
75+ current-transport: local-azure-storage-queues
76+ transports:
77+ - name: local-azure-storage-queues
78+ azure-storage-queues-transport-config:
79+ connection-string: UseDevelopmentStorage=true
80+ """ ;
81+ using var configFile = new TestableNServiceBusConfigurationFile ( yamlFile ) ;
82+
83+ // Act
84+ var result = Sut . Run (
85+ "timeout" , "send" ,
86+ "--content-type" , "application/json" ,
87+ "--enclosed-message-type" , "MessageContracts.Timeouts.OrderTimeout" ,
88+ "--destination-endpoint" , "Sales" ,
89+ "--message-body" , "{}" ,
90+ "--delay-delivery-with" , "00:00:01" ,
91+ "--config" , configFile . FilePath ) ;
92+
93+ // Assert
94+ Assert . That ( result . ExitCode , Is . EqualTo ( 1 ) ) ;
95+ Assert . That ( result . Output , Does . Contain ( "AzureStorageQueuesTransport" ) ) ;
96+ Assert . That ( result . Output , Does . Contain ( "does not support sending timeouts" ) ) ;
97+ Assert . That ( result . Output , Does . Contain ( "https://tragiccode.com/busly-cli/docs/cli-reference/timeout/send" ) ) ;
98+ }
99+ }
0 commit comments