File tree Expand file tree Collapse file tree 4 files changed +41
-3
lines changed
LinkDotNet.Blog.IntegrationTests
LinkDotNet.Blog.UnitTests Expand file tree Collapse file tree 4 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 8
8
<ItemGroup >
9
9
<PackageReference Include =" Blazored.Toast" Version =" 3.2.2" />
10
10
<PackageReference Include =" BuildBundlerMinifier" Version =" 3.2.449" />
11
- <PackageReference Include =" Markdig" Version =" 0.26 .0" />
11
+ <PackageReference Include =" Markdig" Version =" 0.27 .0" />
12
12
<PackageReference Include =" Microsoft.AspNetCore.Authentication.OpenIdConnect" Version =" 6.0.1" />
13
13
<PackageReference Include =" Microsoft.EntityFrameworkCore.Sqlite" Version =" 6.0.1" />
14
14
<PackageReference Include =" Microsoft.EntityFrameworkCore.SqlServer" Version =" 6.0.1" />
Original file line number Diff line number Diff line change 7
7
8
8
<ItemGroup >
9
9
<PackageReference Include =" bunit" Version =" 1.4.15" />
10
- <PackageReference Include =" FluentAssertions" Version =" 6.3 .0" />
10
+ <PackageReference Include =" FluentAssertions" Version =" 6.4 .0" />
11
11
<PackageReference Include =" Microsoft.AspNetCore.Mvc.Testing" Version =" 6.0.1" />
12
12
<PackageReference Include =" Microsoft.EntityFrameworkCore.Sqlite" Version =" 6.0.1" />
13
13
<PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.1.0-preview-20211130-02" />
Original file line number Diff line number Diff line change 8
8
9
9
<ItemGroup >
10
10
<PackageReference Include =" bunit" Version =" 1.4.15" />
11
- <PackageReference Include =" FluentAssertions" Version =" 6.3 .0" />
11
+ <PackageReference Include =" FluentAssertions" Version =" 6.4 .0" />
12
12
<PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.1.0-preview-20211130-02" />
13
13
<PackageReference Include =" Moq" Version =" 4.16.1" />
14
14
<PackageReference Include =" SonarAnalyzer.CSharp" Version =" 8.34.0.42011" >
Original file line number Diff line number Diff line change
1
+ using System . Threading . Tasks ;
2
+ using Bunit ;
3
+ using FluentAssertions ;
4
+ using LinkDotNet . Blog . Domain ;
5
+ using LinkDotNet . Blog . Infrastructure . Persistence ;
6
+ using LinkDotNet . Blog . TestUtilities ;
7
+ using LinkDotNet . Blog . Web . Pages ;
8
+ using LinkDotNet . Blog . Web . Shared ;
9
+ using LinkDotNet . Blog . Web . Shared . Services ;
10
+ using Microsoft . Extensions . DependencyInjection ;
11
+ using Moq ;
12
+ using Xunit ;
13
+
14
+ namespace LinkDotNet . Blog . UnitTests . Web . Pages ;
15
+
16
+ public class BlogPostPageTests : TestContext
17
+ {
18
+ [ Fact ]
19
+ public void ShouldShowLoadingAnimation ( )
20
+ {
21
+ const string blogPostId = "2" ;
22
+ var repositoryMock = new Mock < IRepository < BlogPost > > ( ) ;
23
+ JSInterop . Mode = JSRuntimeMode . Loose ;
24
+ Services . AddScoped ( _ => repositoryMock . Object ) ;
25
+ Services . AddScoped ( _ => Mock . Of < IUserRecordService > ( ) ) ;
26
+ repositoryMock . Setup ( r => r . GetByIdAsync ( blogPostId ) )
27
+ . Returns ( async ( ) =>
28
+ {
29
+ await Task . Delay ( 250 ) ;
30
+ return new BlogPostBuilder ( ) . Build ( ) ;
31
+ } ) ;
32
+
33
+ var cut = RenderComponent < BlogPostPage > (
34
+ p => p . Add ( s => s . BlogPostId , blogPostId ) ) ;
35
+
36
+ cut . FindComponents < Loading > ( ) . Count . Should ( ) . Be ( 1 ) ;
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments