-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLearningTransportConfigValidatorTests.cs
More file actions
48 lines (41 loc) · 1.34 KB
/
LearningTransportConfigValidatorTests.cs
File metadata and controls
48 lines (41 loc) · 1.34 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
using Bogus;
using BuslyCLI.Config.Transports;
using BuslyCLI.Config.Validators;
using FluentValidation.TestHelper;
namespace BuslyCLI.Console.Tests.Config.Validators;
[TestFixture]
public class LearningTransportConfigValidatorTests
{
private readonly LearningTransportConfigValidator _validator;
public LearningTransportConfigValidatorTests()
{
_validator = new LearningTransportConfigValidator();
}
[Test]
public async Task ShouldErrorWhenStorageDirectoryIsNotPassed()
{
// Arrange
var learningTransportConfig = new LearningTransportConfig
{
StorageDirectory = null
};
// Act
var result = await _validator.TestValidateAsync(learningTransportConfig);
// Assert
result.ShouldHaveValidationErrorFor(c => c.StorageDirectory)
.WithErrorMessage("'Storage Directory' must not be empty.");
}
[Test]
public async Task ShouldNotErrorStorageDirectoryIsPassed()
{
// Arrange
var learningTransportConfig = new LearningTransportConfig
{
StorageDirectory = new Faker().System.DirectoryPath()
};
// Act
var result = await _validator.TestValidateAsync(learningTransportConfig);
// Assert
result.ShouldNotHaveValidationErrorFor(c => c.StorageDirectory);
}
}