mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-13 01:28:40 +00:00
Add test harness and run the first program (#5)
This commit is contained in:
21
WoofWare.PawPrint.Test/Assembly.fs
Normal file
21
WoofWare.PawPrint.Test/Assembly.fs
Normal 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 ()
|
Reference in New Issue
Block a user