1
1
using System ;
2
2
using System . Reflection ;
3
3
using FluentAssertions ;
4
- using Wasmtime ;
5
4
using Xunit ;
6
5
7
6
namespace Wasmtime . Tests
@@ -11,7 +10,7 @@ public class ModuleLoadTests
11
10
[ Fact ]
12
11
public void ItLoadsModuleFromEmbeddedResource ( )
13
12
{
14
- using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wasm" ) ;
13
+ using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wasm" ) ! ;
15
14
stream . Should ( ) . NotBeNull ( ) ;
16
15
17
16
using var engine = new Engine ( ) ;
@@ -20,18 +19,18 @@ public void ItLoadsModuleFromEmbeddedResource()
20
19
// `LoadModule` is not supposed to close the supplied stream,
21
20
// so the following statement should complete without throwing
22
21
// `ObjectDisposedException`
23
- stream . Read ( new byte [ 0 ] , 0 , 0 ) ;
22
+ stream . ReadExactly ( Array . Empty < byte > ( ) , 0 , 0 ) ;
24
23
}
25
24
26
25
[ Fact ]
27
26
public void ItValidatesModuleFromEmbeddedResource ( )
28
27
{
29
- using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wasm" ) ;
28
+ using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wasm" ) ! ;
30
29
stream . Should ( ) . NotBeNull ( ) ;
31
30
32
31
byte [ ] buffer = new byte [ stream . Length ] ;
33
32
34
- stream . Read ( buffer , 0 , buffer . Length ) ;
33
+ stream . ReadExactly ( buffer , 0 , buffer . Length ) ;
35
34
36
35
using var engine = new Engine ( ) ;
37
36
Module . Validate ( engine , buffer ) . Should ( ) . BeNull ( ) ;
@@ -40,7 +39,7 @@ public void ItValidatesModuleFromEmbeddedResource()
40
39
[ Fact ]
41
40
public void ItLoadsModuleTextFromEmbeddedResource ( )
42
41
{
43
- using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wat" ) ;
42
+ using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wat" ) ! ;
44
43
stream . Should ( ) . NotBeNull ( ) ;
45
44
46
45
using var engine = new Engine ( ) ;
@@ -49,13 +48,13 @@ public void ItLoadsModuleTextFromEmbeddedResource()
49
48
// `LoadModuleText` is not supposed to close the supplied stream,
50
49
// so the following statement should complete without throwing
51
50
// `ObjectDisposedException`
52
- stream . Read ( new byte [ 0 ] , 0 , 0 ) ;
51
+ stream . ReadExactly ( new byte [ 0 ] , 0 , 0 ) ;
53
52
}
54
53
55
54
[ Fact ]
56
55
public void ItCannotBeAccessedOnceDisposed ( )
57
56
{
58
- using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wasm" ) ;
57
+ using var stream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "hello.wasm" ) ! ;
59
58
stream . Should ( ) . NotBeNull ( ) ;
60
59
61
60
using var engine = new Engine ( ) ;
0 commit comments