-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransportConfigValidatorTests.cs
More file actions
50 lines (41 loc) · 1.19 KB
/
TransportConfigValidatorTests.cs
File metadata and controls
50 lines (41 loc) · 1.19 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
48
49
50
using BuslyCLI.Config;
using BuslyCLI.Config.Validators;
using FluentValidation.TestHelper;
using TransportConfig = BuslyCLI.Config.TransportConfig;
namespace BuslyCLI.Console.Tests.Config.Validators;
[TestFixture]
public class TransportConfigValidatorTests
{
private readonly TransportConfigValidator _validator;
public TransportConfigValidatorTests()
{
_validator = new TransportConfigValidator();
}
[Test]
public async Task ShouldNotErrorWhenCurrentNameIsDefined()
{
// Arrange
var config = new TransportConfig()
{
Name = "local-learning"
};
// Act
var result = await _validator.TestValidateAsync(config);
// Assert
result.ShouldNotHaveValidationErrorFor(x => x.Name);
}
[Test]
public async Task ShouldErrorWhenCurrentTransportIsNotDefined()
{
// Arrange
var config = new TransportConfig()
{
Name = null
};
// Act
var result = await _validator.TestValidateAsync(config);
// Assert
result.ShouldHaveValidationErrorFor(c => c.Name)
.WithErrorMessage("'Name' must not be empty.");
}
}