|
1 | | -using NUnit.Framework; |
2 | | -using Solcast.Clients; |
3 | | -using System.Threading.Tasks; |
4 | | - |
5 | | -namespace Solcast.Tests |
6 | | -{ |
7 | | - [TestFixture] |
8 | | - public class AggregationClientTests |
9 | | - { |
10 | | - private AggregationClient _aggregationClient; |
11 | | - |
12 | | - [SetUp] |
13 | | - public void Setup() |
14 | | - { |
15 | | - _aggregationClient = new AggregationClient(); |
16 | | - } |
17 | | - |
18 | | - [Test] |
19 | | - public async Task GetLiveAggregation_ShouldReturnValidData() |
20 | | - { |
21 | | - var response = await _aggregationClient.GetLiveAggregations( |
22 | | - collectionId: "country_total", |
23 | | - aggregationId: "it_total" |
24 | | - ); |
25 | | - Assert.IsNotNull(response); |
26 | | - } |
27 | | - |
28 | | - [Test] |
29 | | - public async Task GetForecastAggregation_ShouldReturnValidData() |
30 | | - { |
31 | | - var response = await _aggregationClient.GetForecastAggregations( |
32 | | - collectionId: "country_total", |
33 | | - aggregationId: "it_total", |
34 | | - outputParameters: ["percentage", "pv_estimate"] |
35 | | - ); |
36 | | - Assert.IsNotNull(response); |
37 | | - } |
38 | | - } |
39 | | -} |
| 1 | +using NUnit.Framework; |
| 2 | +using Solcast.Clients; |
| 3 | +using System; |
| 4 | +using System.Threading.Tasks; |
| 5 | + |
| 6 | +namespace Solcast.Tests |
| 7 | +{ |
| 8 | + [TestFixture] |
| 9 | + public class AggregationClientTests : IDisposable |
| 10 | + { |
| 11 | + private AggregationClient _aggregationClient; |
| 12 | + private bool _disposed = false; |
| 13 | + |
| 14 | + [SetUp] |
| 15 | + public void Setup() |
| 16 | + { |
| 17 | + _aggregationClient = new AggregationClient(); |
| 18 | + } |
| 19 | + |
| 20 | + [Test] |
| 21 | + public async Task GetLiveAggregation_ShouldReturnValidData() |
| 22 | + { |
| 23 | + var response = await _aggregationClient.GetLiveAggregations( |
| 24 | + collectionId: "country_total", |
| 25 | + aggregationId: "it_total" |
| 26 | + ); |
| 27 | + Assert.IsNotNull(response); |
| 28 | + } |
| 29 | + |
| 30 | + [Test] |
| 31 | + public async Task GetForecastAggregation_ShouldReturnValidData() |
| 32 | + { |
| 33 | + var response = await _aggregationClient.GetForecastAggregations( |
| 34 | + collectionId: "country_total", |
| 35 | + aggregationId: "it_total", |
| 36 | + outputParameters: ["percentage", "pv_estimate"] |
| 37 | + ); |
| 38 | + Assert.IsNotNull(response); |
| 39 | + } |
| 40 | + |
| 41 | + public void Dispose() |
| 42 | + { |
| 43 | + if (!_disposed) |
| 44 | + { |
| 45 | + _aggregationClient?.Dispose(); |
| 46 | + _disposed = true; |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | +} |
0 commit comments