-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAzureStorageQueuesTransportConfigValidatorTests.cs
More file actions
47 lines (40 loc) · 1.65 KB
/
AzureStorageQueuesTransportConfigValidatorTests.cs
File metadata and controls
47 lines (40 loc) · 1.65 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
43
44
45
46
47
using BuslyCLI.Config.Transports;
using BuslyCLI.Config.Validators;
using FluentValidation.TestHelper;
namespace BuslyCLI.Console.Tests.Config.Validators;
[TestFixture]
public class AzureStorageQueuesTransportConfigValidatorTests
{
private readonly AzureStorageQueuesTransportConfigValidator _validator;
public AzureStorageQueuesTransportConfigValidatorTests()
{
_validator = new AzureStorageQueuesTransportConfigValidator();
}
[Test]
public async Task ShouldErrorWhenConnectionStringIsNotPassed()
{
// Arrange
var azureStorageQueuesTransportConfig = new AzureStorageQueuesTransportConfig
{
ConnectionString = null
};
// Act
var result = await _validator.TestValidateAsync(azureStorageQueuesTransportConfig);
// Assert
result.ShouldHaveValidationErrorFor(c => c.ConnectionString)
.WithErrorMessage("'Connection String' must not be empty.");
}
[Test]
public async Task ShouldNotErrorWhenConnectionStringIsPassed()
{
// Arrange
var azureStorageQueuesTransportConfig = new AzureStorageQueuesTransportConfig
{
ConnectionString = "DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1"
};
// Act
var result = await _validator.TestValidateAsync(azureStorageQueuesTransportConfig);
// Assert
result.ShouldNotHaveValidationErrorFor(c => c.ConnectionString);
}
}