File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
test/MyTested.AspNetCore.Mvc.ViewData.Test/PluginsTests Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ namespace MyTested . AspNetCore . Mvc . Test . PluginsTests
2
+ {
3
+ using Microsoft . Extensions . DependencyInjection ;
4
+ using Plugins ;
5
+ using System ;
6
+ using Xunit ;
7
+
8
+ public class ViewDataTestPluginTests
9
+ {
10
+ [ Fact ]
11
+ public void ShouldHavePriorityWithDefaultValue ( )
12
+ {
13
+ var testPlugin = new ViewDataTestPlugin ( ) ;
14
+
15
+ Assert . IsAssignableFrom < IDefaultRegistrationPlugin > ( testPlugin ) ;
16
+ Assert . NotNull ( testPlugin ) ;
17
+ Assert . Equal ( - 1000 , testPlugin . Priority ) ;
18
+ }
19
+
20
+ [ Fact ]
21
+ public void ShouldThrowArgumentNullExceptionWithInvalidServiceCollection ( )
22
+ {
23
+ var testPlugin = new ViewDataTestPlugin ( ) ;
24
+
25
+ Assert . Throws < ArgumentNullException > ( ( ) => testPlugin . DefaultServiceRegistrationDelegate ( null ) ) ;
26
+ }
27
+
28
+ [ Fact ]
29
+ public void ShouldInvokeMethodOfTypeVoidWithValidServiceCollection ( )
30
+ {
31
+ var testPlugin = new ViewDataTestPlugin ( ) ;
32
+ var serviceCollection = new ServiceCollection ( ) ;
33
+
34
+ testPlugin . DefaultServiceRegistrationDelegate ( serviceCollection ) ;
35
+
36
+ var methodReturnType = testPlugin . DefaultServiceRegistrationDelegate . Method . ReturnType . Name ;
37
+
38
+ Assert . True ( methodReturnType == "Void" ) ;
39
+ Assert . True ( serviceCollection . Count == 126 ) ;
40
+ }
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments