File tree Expand file tree Collapse file tree 3 files changed +21
-35
lines changed
test/SeqCli.EndToEnd/License Expand file tree Collapse file tree 3 files changed +21
-35
lines changed Original file line number Diff line number Diff line change @@ -34,25 +34,15 @@ protected override async Task<int> Run()
3434 var connection = _connectionFactory . Connect ( _connection ) ;
3535 var license = await connection . Licenses . FindCurrentAsync ( ) ;
3636
37- if ( license == null )
37+ if ( _output . Json )
3838 {
39- Log . Warning ( "No license is currently applied to the server." ) ;
40- return 2 ;
39+ _output . WriteEntity ( license ) ;
4140 }
42-
43- _output . WriteEntity ( _output . Json ? license : new OutputWrapperLicenseEntity ( license ) ) ;
44-
45- return 0 ;
46- }
47-
48- /// <summary>
49- /// Wraps the license entity for none json output.
50- /// </summary>
51- class OutputWrapperLicenseEntity : Entity
52- {
53- public OutputWrapperLicenseEntity ( LicenseEntity license )
41+ else
5442 {
55- this . Id = license . LicenseText ;
43+ _output . WriteText ( license ? . LicenseText ) ;
5644 }
45+
46+ return 0 ;
5747 }
58- }
48+ }
Original file line number Diff line number Diff line change @@ -185,4 +185,10 @@ public void ListEntities(IEnumerable<Entity> list)
185185 WriteEntity ( entity ) ;
186186 }
187187 }
188- }
188+
189+ // ReSharper disable once MemberCanBeMadeStatic.Global
190+ public void WriteText ( string ? text )
191+ {
192+ Console . WriteLine ( text ? . TrimEnd ( ) ) ;
193+ }
194+ }
Original file line number Diff line number Diff line change 1- using System ;
2- using System . IO ;
3- using System . Threading . Tasks ;
1+ using System . Threading . Tasks ;
42using Seq . Api ;
53using SeqCli . EndToEnd . Support ;
64using Serilog ;
@@ -10,27 +8,19 @@ namespace SeqCli.EndToEnd.License;
108
119public class LicenseShowTestCase : ICliTestCase
1210{
13- readonly TestDataFolder _testDataFolder ;
14-
15- public LicenseShowTestCase ( TestDataFolder testDataFolder )
11+ public async Task ExecuteAsync ( SeqConnection connection , ILogger logger , CliCommandRunner runner )
1612 {
17- _testDataFolder = testDataFolder ;
18- }
19-
20- public Task ExecuteAsync ( SeqConnection connection , ILogger logger , CliCommandRunner runner )
21- {
22-
23- // test empty text output if no license is applied
13+ var license = await connection . Licenses . FindCurrentAsync ( ) ;
14+ Assert . True ( license . IsSingleUser ) ;
15+
2416 runner . Exec ( "license show" ) ;
2517 Assert . Equal (
2618 "" ,
27- runner . LastRunProcess . Output . Trim ( ) ) ;
19+ runner . LastRunProcess ! . Output . Trim ( ) ) ;
2820
29- // test json output if no license is applied
3021 runner . Exec ( "license show --json" ) ;
3122 Assert . Contains (
3223 "You're using the free Individual license." ,
33- runner . LastRunProcess . Output . Trim ( ) ) ;
34- return Task . CompletedTask ;
24+ runner . LastRunProcess ! . Output . Trim ( ) ) ;
3525 }
3626}
You can’t perform that action at this time.
0 commit comments