File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
tests/LinkDotNet.Blog.UnitTests/Web/Shared/Services Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System . IO ;
2
+ using System . Threading . Tasks ;
3
+ using FluentAssertions ;
4
+ using LinkDotNet . Blog . Web . Shared . Services ;
5
+ using Microsoft . AspNetCore . Components . Forms ;
6
+ using Moq ;
7
+ using Xunit ;
8
+
9
+ namespace LinkDotNet . Blog . UnitTests . Web . Shared . Services ;
10
+
11
+ public class FileProcessorTests
12
+ {
13
+ [ Fact ]
14
+ public async Task ShouldProcessFileContent ( )
15
+ {
16
+ var browserFile = new Mock < IBrowserFile > ( ) ;
17
+ await using var stream = new MemoryStream ( ) ;
18
+ await using var writer = new StreamWriter ( stream ) ;
19
+ const string streamString = "Hello World" ;
20
+ await writer . WriteAsync ( streamString ) ;
21
+ await writer . FlushAsync ( ) ;
22
+ stream . Position = 0 ;
23
+ browserFile . Setup ( b => b . OpenReadStream ( It . IsAny < long > ( ) , default ) )
24
+ . Returns ( stream ) ;
25
+
26
+ var content = await new FileProcessor ( ) . GetContent ( browserFile . Object ) ;
27
+
28
+ content . Should ( ) . Be ( streamString ) ;
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments