-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathThroughputCollector_AdditionalEnvironmentDataProvider_Tests.cs
More file actions
42 lines (37 loc) · 1.55 KB
/
ThroughputCollector_AdditionalEnvironmentDataProvider_Tests.cs
File metadata and controls
42 lines (37 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
namespace Particular.LicensingComponent.UnitTests;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using Particular.LicensingComponent.Contracts;
using Particular.LicensingComponent.UnitTests.Infrastructure;
[TestFixture]
class ThroughputCollector_AdditionalEnvironmentDataProvider_Tests : ThroughputCollectorTestFixture
{
public override Task Setup()
{
SetExtraDependencies = services => services.AddSingleton<IEnvironmentDataProvider, TestAdditionalEnvironmentDataProvider>();
return base.Setup();
}
[Test]
public async Task Should_include_additional_environment_data_in_throughput_report()
{
// Arrange
// Act
var report = await ThroughputCollector.GenerateThroughputReport(null, null, default);
// Assert
Assert.That(report, Is.Not.Null);
Assert.That(report.ReportData, Is.Not.Null);
Assert.That(report.ReportData.EnvironmentInformation, Is.Not.Null);
Assert.That(report.ReportData.EnvironmentInformation.EnvironmentData, Is.Not.Null);
Assert.That(report.ReportData.EnvironmentInformation.EnvironmentData.ContainsKey("TestKey"));
Assert.That(report.ReportData.EnvironmentInformation.EnvironmentData["TestKey"], Is.EqualTo("TestValue"));
}
class TestAdditionalEnvironmentDataProvider : IEnvironmentDataProvider
{
public IEnumerable<(string key, string value)> GetData()
{
yield return ("TestKey", "TestValue");
}
}
}