-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAzureServiceBusTransportConfigValidatorTests.cs
More file actions
47 lines (40 loc) · 1.49 KB
/
AzureServiceBusTransportConfigValidatorTests.cs
File metadata and controls
47 lines (40 loc) · 1.49 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;
using BuslyCLI.Config.Validators;
using FluentValidation.TestHelper;
namespace BuslyCLI.Console.Tests.Config.Validators;
[TestFixture]
public class AzureServiceBusTransportConfigValidatorTests
{
private readonly AzureServiceBusTransportConfigValidator _validator;
public AzureServiceBusTransportConfigValidatorTests()
{
_validator = new AzureServiceBusTransportConfigValidator();
}
[Test]
public async Task ShouldErrorWhenConnectionStringIsNotPassed()
{
// Arrange
var azureServiceBusTransportConfig = new AzureServiceBusTransportConfig
{
ConnectionString = null
};
// Act
var result = await _validator.TestValidateAsync(azureServiceBusTransportConfig);
// Assert
result.ShouldHaveValidationErrorFor(c => c.ConnectionString)
.WithErrorMessage("'Connection String' must not be empty.");
}
[Test]
public async Task ShouldNotErrorStorageDirectoryIsPassed()
{
// Arrange
var azureServiceBusTransportConfig = new AzureServiceBusTransportConfig
{
ConnectionString = "Endpoint=amqp://127.0.0.1:32799/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true"
};
// Act
var result = await _validator.TestValidateAsync(azureServiceBusTransportConfig);
// Assert
result.ShouldNotHaveValidationErrorFor(c => c.ConnectionString);
}
}