File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
tests/LinkDotNet.Blog.UnitTests/Web/Shared Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ using Bunit ;
2+ using FluentAssertions ;
3+ using LinkDotNet . Blog . Web ;
4+ using LinkDotNet . Blog . Web . Shared ;
5+ using LinkDotNet . Blog . Web . Shared . Services ;
6+ using Microsoft . Extensions . DependencyInjection ;
7+ using Xunit ;
8+
9+ namespace LinkDotNet . Blog . UnitTests . Web . Shared ;
10+
11+ public class CommentSectionTests : TestContext
12+ {
13+ [ Fact ]
14+ public void ShouldShowDisqusWhenConfigured ( )
15+ {
16+ Services . AddScoped ( _ => new AppConfiguration { DisqusConfiguration = new DisqusConfiguration ( ) } ) ;
17+ JSInterop . Mode = JSRuntimeMode . Loose ;
18+
19+ var cut = RenderComponent < CommentSection > ( ) ;
20+
21+ cut . FindComponents < Disqus > ( ) . Should ( ) . NotBeEmpty ( ) ;
22+ }
23+
24+ [ Fact ]
25+ public void ShouldShowGiscusWhenConfigured ( )
26+ {
27+ Services . AddScoped ( _ => new AppConfiguration { GiscusConfiguration = new GiscusConfiguration ( ) } ) ;
28+ JSInterop . Mode = JSRuntimeMode . Loose ;
29+
30+ var cut = RenderComponent < CommentSection > ( ) ;
31+
32+ cut . FindComponents < Giscus > ( ) . Should ( ) . NotBeEmpty ( ) ;
33+ }
34+
35+ [ Fact ]
36+ public void ShouldShowAlertWhenMultipleRegistered ( )
37+ {
38+ Services . AddScoped ( _ => new AppConfiguration
39+ { DisqusConfiguration = new DisqusConfiguration ( ) , GiscusConfiguration = new GiscusConfiguration ( ) } ) ;
40+ JSInterop . Mode = JSRuntimeMode . Loose ;
41+
42+ var cut = RenderComponent < CommentSection > ( ) ;
43+
44+ cut . FindAll ( ".alert-danger" ) . Should ( ) . NotBeEmpty ( ) ;
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments