File tree Expand file tree Collapse file tree 9 files changed +153
-0
lines changed
Expand file tree Collapse file tree 9 files changed +153
-0
lines changed Original file line number Diff line number Diff line change 11using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Erp ;
2+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Tax ;
23using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . System . Api ;
34using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . System . Ui ;
45
@@ -20,4 +21,9 @@ public static ErpApiClient CreateErpApiClient()
2021 {
2122 return new ErpApiClient ( TestConfiguration . ErpApiBaseUrl ) ;
2223 }
24+
25+ public static TaxApiClient CreateTaxApiClient ( )
26+ {
27+ return new TaxApiClient ( TestConfiguration . TaxApiBaseUrl ) ;
28+ }
2329}
Original file line number Diff line number Diff line change 1+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . Commons ;
2+
3+ namespace Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Erp . Controllers ;
4+
5+ public class HomeController
6+ {
7+ private const string Endpoint = "/" ;
8+
9+ private readonly TestHttpClient _httpClient ;
10+
11+ public HomeController ( TestHttpClient httpClient )
12+ {
13+ _httpClient = httpClient ;
14+ }
15+
16+ public async Task < HttpResponseMessage > HomeAsync ( )
17+ {
18+ return await _httpClient . GetAsync ( Endpoint ) ;
19+ }
20+
21+ public void AssertHomeSuccessful ( HttpResponseMessage httpResponse )
22+ {
23+ _httpClient . AssertOk ( httpResponse ) ;
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -7,15 +7,18 @@ public class ErpApiClient : IAsyncDisposable
77{
88 private readonly HttpClient _client ;
99 private readonly TestHttpClient _testHttpClient ;
10+ private readonly HomeController _homeController ;
1011 private readonly ProductController _productController ;
1112
1213 public ErpApiClient ( string baseUrl )
1314 {
1415 _client = new HttpClient ( ) ;
1516 _testHttpClient = new TestHttpClient ( _client , baseUrl ) ;
17+ _homeController = new HomeController ( _testHttpClient ) ;
1618 _productController = new ProductController ( _testHttpClient ) ;
1719 }
1820
21+ public HomeController Home ( ) => _homeController ;
1922 public ProductController Products ( ) => _productController ;
2023
2124 public async ValueTask DisposeAsync ( )
Original file line number Diff line number Diff line change 1+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . Commons ;
2+
3+ namespace Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Tax . Controllers ;
4+
5+ public class HomeController
6+ {
7+ private const string Endpoint = "/" ;
8+
9+ private readonly TestHttpClient _httpClient ;
10+
11+ public HomeController ( TestHttpClient httpClient )
12+ {
13+ _httpClient = httpClient ;
14+ }
15+
16+ public async Task < HttpResponseMessage > HomeAsync ( )
17+ {
18+ return await _httpClient . GetAsync ( Endpoint ) ;
19+ }
20+
21+ public void AssertHomeSuccessful ( HttpResponseMessage httpResponse )
22+ {
23+ _httpClient . AssertOk ( httpResponse ) ;
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . Commons ;
2+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Tax . Controllers ;
3+
4+ namespace Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Tax ;
5+
6+ public class TaxApiClient : IAsyncDisposable
7+ {
8+ private readonly HttpClient _client ;
9+ private readonly TestHttpClient _testHttpClient ;
10+ private readonly HomeController _homeController ;
11+
12+ public TaxApiClient ( string baseUrl )
13+ {
14+ _client = new HttpClient ( ) ;
15+ _testHttpClient = new TestHttpClient ( _client , baseUrl ) ;
16+ _homeController = new HomeController ( _testHttpClient ) ;
17+ }
18+
19+ public HomeController Home ( ) => _homeController ;
20+
21+ public async ValueTask DisposeAsync ( )
22+ {
23+ _client . Dispose ( ) ;
24+ await Task . CompletedTask ;
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients ;
2+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Erp ;
3+
4+ namespace Optivem . AtddAccelerator . EShop . SystemTest . SmokeTests . External ;
5+
6+ public class ErpApiSmokeTest : IAsyncLifetime
7+ {
8+ private ErpApiClient _erpApiClient = default ! ;
9+
10+ public Task InitializeAsync ( )
11+ {
12+ _erpApiClient = ClientFactory . CreateErpApiClient ( ) ;
13+ return Task . CompletedTask ;
14+ }
15+
16+ public async Task DisposeAsync ( )
17+ {
18+ await ClientCloser . CloseAsync ( _erpApiClient ) ;
19+ }
20+
21+ [ Fact ]
22+ public async Task Home_ShouldReturn200OK ( )
23+ {
24+ // Act
25+ var httpResponse = await _erpApiClient . Home ( ) . HomeAsync ( ) ;
26+
27+ // Assert
28+ _erpApiClient . Home ( ) . AssertHomeSuccessful ( httpResponse ) ;
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients ;
2+ using Optivem . AtddAccelerator . EShop . SystemTest . Core . Clients . External . Tax ;
3+
4+ namespace Optivem . AtddAccelerator . EShop . SystemTest . SmokeTests . External ;
5+
6+ public class TaxApiSmokeTest : IAsyncLifetime
7+ {
8+ private TaxApiClient _taxApiClient = default ! ;
9+
10+ public Task InitializeAsync ( )
11+ {
12+ _taxApiClient = ClientFactory . CreateTaxApiClient ( ) ;
13+ return Task . CompletedTask ;
14+ }
15+
16+ public async Task DisposeAsync ( )
17+ {
18+ await ClientCloser . CloseAsync ( _taxApiClient ) ;
19+ }
20+
21+ [ Fact ]
22+ public async Task Home_ShouldReturn200OK ( )
23+ {
24+ // Act
25+ var httpResponse = await _taxApiClient . Home ( ) . HomeAsync ( ) ;
26+
27+ // Assert
28+ _taxApiClient . Home ( ) . AssertHomeSuccessful ( httpResponse ) ;
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -23,4 +23,7 @@ static TestConfiguration()
2323
2424 // ERP configuration
2525 public static string ErpApiBaseUrl => _configuration [ "Test:Erp:Api:BaseUrl" ] ?? "http://localhost:3100" ;
26+
27+ // Tax configuration
28+ public static string TaxApiBaseUrl => _configuration [ "Test:Tax:Api:BaseUrl" ] ?? "http://localhost:3101" ;
2629}
Original file line number Diff line number Diff line change 1212 "Api" : {
1313 "BaseUrl" : " http://localhost:3100"
1414 }
15+ },
16+ "Tax" : {
17+ "Api" : {
18+ "BaseUrl" : " http://localhost:3101"
19+ }
1520 }
1621 },
1722 "WaitSeconds" : 10
You can’t perform that action at this time.
0 commit comments