Add test harness and run the first program (#5)

This commit is contained in:
Patrick Stevens
2025-04-28 20:23:05 +01:00
committed by GitHub
parent 90f95ed6c6
commit 3415b7a73d
14 changed files with 703 additions and 116 deletions

View File

@@ -0,0 +1,21 @@
namespace WoofWare.PawPrint.Test
open System
open System.IO
open System.Reflection
[<RequireQualifiedAccess>]
module Assembly =
let getEmbeddedResource (name : string) (assy : Assembly) : Stream =
let resourceName =
assy.GetManifestResourceNames ()
|> Seq.filter (fun a -> a.EndsWith (name, StringComparison.Ordinal))
|> Seq.exactlyOne
assy.GetManifestResourceStream resourceName
let getEmbeddedResourceAsString (name : string) (assy : Assembly) : string =
use stream = getEmbeddedResource name assy
use reader = new StreamReader (stream, leaveOpen = true)
reader.ReadToEnd ()