File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed
src/Microsoft.OpenApi/Validations
test/Microsoft.OpenApi.Tests/Validations Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 5
5
using System . Diagnostics ;
6
6
using Microsoft . OpenApi . Interfaces ;
7
7
8
- namespace Microsoft . OpenApi . Validations . Rules
8
+ namespace Microsoft . OpenApi . Validations
9
9
{
10
10
/// <summary>
11
11
/// Class containing validation rule logic.
Original file line number Diff line number Diff line change 8
8
using System . Collections . Generic ;
9
9
using Microsoft . OpenApi . Exceptions ;
10
10
using Microsoft . OpenApi . Properties ;
11
+ using Microsoft . OpenApi . Validations . Rules ;
11
12
12
- namespace Microsoft . OpenApi . Validations . Rules
13
+ namespace Microsoft . OpenApi . Validations
13
14
{
14
15
/// <summary>
15
16
/// The rule set of the validation.
Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT license.
3
+
4
+ using System . Linq ;
5
+ using Xunit ;
6
+
7
+ namespace Microsoft . OpenApi . Validations . Tests
8
+ {
9
+ public class ValidationRuleSetTests
10
+ {
11
+ [ Fact ]
12
+ public void DefaultRuleSetReturnsTheCorrectRules ( )
13
+ {
14
+ // Arrange
15
+ var ruleSet = new ValidationRuleSet ( ) ;
16
+
17
+ // Act
18
+ var rules = ruleSet . Rules ;
19
+
20
+ // Assert
21
+ Assert . NotNull ( rules ) ;
22
+ Assert . Empty ( rules ) ;
23
+ }
24
+
25
+ [ Fact ]
26
+ public void DefaultRuleSetPropertyReturnsTheCorrectRules ( )
27
+ {
28
+ // Arrange & Act
29
+ var ruleSet = ValidationRuleSet . DefaultRuleSet ;
30
+ Assert . NotNull ( ruleSet ) ; // guard
31
+
32
+ var rules = ruleSet . Rules ;
33
+
34
+ // Assert
35
+ Assert . NotNull ( rules ) ;
36
+ Assert . NotEmpty ( rules ) ;
37
+ Assert . Equal ( 13 , rules . ToList ( ) . Count ) ; // please update the number if you add new rule.
38
+ }
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments