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 ;
13using System . Collections ;
24using System . Collections . Generic ;
35using Microsoft . Extensions . DependencyInjection ;
@@ -10,5 +12,17 @@ IEnumerator IEnumerable.GetEnumerator()
1012 {
1113 return GetEnumerator ( ) ;
1214 }
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+ }
1327 }
1428}
You can’t perform that action at this time.
0 commit comments