8
8
using System . Text ;
9
9
using SharpYaml . Serialization ;
10
10
using Xunit ;
11
+ using FluentAssertions ;
11
12
12
13
namespace Microsoft . OpenApi . Readers . Tests
13
14
{
@@ -19,7 +20,7 @@ public void CheckOpenAPIVersion()
19
20
var stream = GetType ( ) . Assembly . GetManifestResourceStream ( typeof ( BasicTests ) , "Samples.petstore30.yaml" ) ;
20
21
var openApiDoc = new OpenApiStreamReader ( ) . Read ( stream , out var context ) ;
21
22
22
- Assert . Equal ( "3.0.0" , openApiDoc . SpecVersion . ToString ( ) ) ;
23
+ openApiDoc . SpecVersion . ToString ( ) . Should ( ) . Be ( "3.0.0" ) ;
23
24
}
24
25
25
26
[ Fact ]
@@ -40,7 +41,7 @@ public void InlineExample()
40
41
" ,
41
42
out var parsingContext ) ;
42
43
43
- Assert . Equal ( "3.0.0" , openApiDoc . SpecVersion . ToString ( ) ) ;
44
+ openApiDoc . SpecVersion . ToString ( ) . Should ( ) . Be ( "3.0.0" ) ;
44
45
}
45
46
46
47
[ Fact ]
@@ -51,9 +52,8 @@ public void ParseBrokenSimplest()
51
52
52
53
var openApiDoc = new OpenApiStreamReader ( ) . Read ( stream , out var context ) ;
53
54
54
- Assert . Equal ( 1 , context . Errors . Count ) ;
55
- Assert . NotNull (
56
- context . Errors . Where ( s => s . ToString ( ) == "title is a required property of #/info" ) . FirstOrDefault ( ) ) ;
55
+ context . Errors . Should ( ) . HaveCount ( 1 ) ;
56
+ context . Errors . Select ( s => s . ToString ( ) ) . Should ( ) . Contain ( "title is a required property of #/info" ) ;
57
57
}
58
58
59
59
[ Fact ]
@@ -63,11 +63,11 @@ public void ParseSimplestOpenApiEver()
63
63
64
64
var openApiDoc = new OpenApiStreamReader ( ) . Read ( stream , out var context ) ;
65
65
66
- Assert . Equal ( "1.0.0" , openApiDoc . SpecVersion . ToString ( ) ) ;
67
- Assert . Empty ( openApiDoc . Paths ) ;
68
- Assert . Equal ( "The Api" , openApiDoc . Info . Title ) ;
69
- Assert . Equal ( "0.9.1" , openApiDoc . Info . Version . ToString ( ) ) ;
70
- Assert . Empty ( context . Errors ) ;
66
+ openApiDoc . SpecVersion . ToString ( ) . Should ( ) . Be ( "1.0.0" ) ;
67
+ openApiDoc . Paths . Should ( ) . BeEmpty ( ) ;
68
+ openApiDoc . Info . Title . Should ( ) . Be ( "The Api" ) ;
69
+ openApiDoc . Info . Version . ToString ( ) . Should ( ) . Be ( "0.9.1" ) ;
70
+ context . Errors . Should ( ) . BeEmpty ( ) ;
71
71
}
72
72
73
73
[ Fact ]
0 commit comments