@@ -69,13 +69,19 @@ This is a test page without products frontmatter.
6969
7070 // Test that the file has the correct products
7171 test <@ defaultFile.File.YamlFrontMatter <> null @>
72- test <@ defaultFile.File.YamlFrontMatter.Products <> null @>
73- test <@ defaultFile.File.YamlFrontMatter.Products.Count = 2 @>
72+ match defaultFile.File.YamlFrontMatter with
73+ | NonNull yamlFrontMatter ->
74+ test <@ yamlFrontMatter.Products <> null @>
75+ match yamlFrontMatter.Products with
76+ | NonNull products ->
77+ test <@ products.Count = 2 @>
78+ // Test that the products are correctly identified
79+ let productIds = products |> Seq.map _. Id |> Set.ofSeq
80+ test <@ productIds.Contains( " elasticsearch" ) @>
81+ test <@ productIds.Contains( " ecctl" ) @>
82+ | _ -> ()
83+ | _ -> ()
7484
75- // Test that the products are correctly identified
76- let productIds = defaultFile.File.YamlFrontMatter.Products |> Seq.map ( fun p -> p.Id) |> Set.ofSeq
77- test <@ productIds.Contains( " elasticsearch" ) @>
78- test <@ productIds.Contains( " ecctl" ) @>
7985
8086 [<Fact>]
8187 let ``does not include products in frontmatter when no products are specified`` () =
@@ -84,4 +90,10 @@ This is a test page without products frontmatter.
8490 let defaultFile = results.MarkdownResults |> Seq.find ( fun r -> r.File.RelativePath = " index.md" )
8591
8692 // Test that the file has no products
87- test <@ defaultFile.File.YamlFrontMatter = null || defaultFile.File.YamlFrontMatter.Products = null || defaultFile.File.YamlFrontMatter.Products.Count = 0 @>
93+ match defaultFile.File.YamlFrontMatter with
94+ | NonNull frontMatter ->
95+ match frontMatter.Products with
96+ | NonNull products ->
97+ test <@ products.Count = 0 @>
98+ | _ -> ()
99+ | _ -> ()
0 commit comments