File tree Expand file tree Collapse file tree 3 files changed +40
-21
lines changed Expand file tree Collapse file tree 3 files changed +40
-21
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ using Xunit ;
2
+ using JsonApiDotNetCore . Routing ;
3
+ using JsonApiDotNetCore . Extensions ;
4
+ using JsonApiDotNetCoreTests . Helpers ;
5
+
6
+ namespace JsonApiDotNetCoreTests . Extensions . UnitTests
7
+ {
8
+ // see example explanation on xUnit.net website:
9
+ // https://xunit.github.io/docs/getting-started-dotnet-core.html
10
+ public class IServiceCollectionExtensionsTests
11
+ {
12
+ [ Fact ]
13
+ public void AddJsonApi_AddsRouterToServiceCollection ( )
14
+ {
15
+ // arrange
16
+ var serviceCollection = new ServiceCollection ( ) ;
17
+
18
+ // act
19
+ serviceCollection . AddJsonApi ( config => { } ) ;
20
+
21
+ // assert
22
+ Assert . True ( serviceCollection . ContainsType ( typeof ( Router ) ) ) ;
23
+ }
24
+
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Linq ;
1
3
using System . Collections ;
2
4
using System . Collections . Generic ;
3
5
using Microsoft . Extensions . DependencyInjection ;
@@ -10,5 +12,17 @@ IEnumerator IEnumerable.GetEnumerator()
10
12
{
11
13
return GetEnumerator ( ) ;
12
14
}
15
+
16
+ public bool ContainsType ( Type type )
17
+ {
18
+ var ret = false ;
19
+ this . ForEach ( sD => {
20
+ if ( sD . ServiceType == type )
21
+ {
22
+ ret = true ;
23
+ }
24
+ } ) ;
25
+ return ret ;
26
+ }
13
27
}
14
28
}
You can’t perform that action at this time.
0 commit comments