Skip to content

Commit ede2e83

Browse files
committed
Added MyTested.AspNetCore.Mvc.Controllers and moved all needed classes there (#125)
1 parent 13a379b commit ede2e83

File tree

204 files changed

+1932
-219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+1932
-219
lines changed

samples/ApplicationParts/ApplicationParts.Test/project.lock.json

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4254,14 +4254,26 @@
42544254
"netstandard1.6/MyTested.AspNetCore.Mvc.Configuration.dll": {}
42554255
}
42564256
},
4257-
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
4257+
"MyTested.AspNetCore.Mvc.Controllers/1.0.0-preview-final": {
42584258
"type": "project",
42594259
"framework": ".NETStandard,Version=v1.6",
42604260
"dependencies": {
4261-
"Microsoft.AspNetCore.Mvc.Core": "1.0.0",
4262-
"Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0",
42634261
"MyTested.AspNetCore.Mvc.Abstractions": "1.0.0"
42644262
},
4263+
"compile": {
4264+
"netstandard1.6/MyTested.AspNetCore.Mvc.Controllers.dll": {}
4265+
},
4266+
"runtime": {
4267+
"netstandard1.6/MyTested.AspNetCore.Mvc.Controllers.dll": {}
4268+
}
4269+
},
4270+
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
4271+
"type": "project",
4272+
"framework": ".NETStandard,Version=v1.6",
4273+
"dependencies": {
4274+
"MyTested.AspNetCore.Mvc.Controllers": "1.0.0",
4275+
"MyTested.AspNetCore.Mvc.Routing": "1.0.0"
4276+
},
42654277
"compile": {
42664278
"netstandard1.6/MyTested.AspNetCore.Mvc.Core.dll": {}
42674279
},
@@ -4314,6 +4326,7 @@
43144326
"type": "project",
43154327
"framework": ".NETStandard,Version=v1.6",
43164328
"dependencies": {
4329+
"Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0",
43174330
"MyTested.AspNetCore.Mvc.Abstractions": "1.0.0"
43184331
},
43194332
"compile": {
@@ -10886,6 +10899,11 @@
1088610899
"path": "../../../src/MyTested.AspNetCore.Mvc.Configuration/project.json",
1088710900
"msbuildProject": "../../../src/MyTested.AspNetCore.Mvc.Configuration/MyTested.AspNetCore.Mvc.Configuration.xproj"
1088810901
},
10902+
"MyTested.AspNetCore.Mvc.Controllers/1.0.0-preview-final": {
10903+
"type": "project",
10904+
"path": "../../../src/MyTested.AspNetCore.Mvc.Controllers/project.json",
10905+
"msbuildProject": "../../../src/MyTested.AspNetCore.Mvc.Controllers/MyTested.AspNetCore.Mvc.Controllers.xproj"
10906+
},
1088910907
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
1089010908
"type": "project",
1089110909
"path": "../../../src/MyTested.AspNetCore.Mvc.Core/project.json",

samples/MusicStore/MusicStore.Test/project.lock.json

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4397,14 +4397,26 @@
43974397
"netstandard1.6/MyTested.AspNetCore.Mvc.Configuration.dll": {}
43984398
}
43994399
},
4400-
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
4400+
"MyTested.AspNetCore.Mvc.Controllers/1.0.0-preview-final": {
44014401
"type": "project",
44024402
"framework": ".NETStandard,Version=v1.6",
44034403
"dependencies": {
4404-
"Microsoft.AspNetCore.Mvc.Core": "1.0.0",
4405-
"Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0",
44064404
"MyTested.AspNetCore.Mvc.Abstractions": "1.0.0"
44074405
},
4406+
"compile": {
4407+
"netstandard1.6/MyTested.AspNetCore.Mvc.Controllers.dll": {}
4408+
},
4409+
"runtime": {
4410+
"netstandard1.6/MyTested.AspNetCore.Mvc.Controllers.dll": {}
4411+
}
4412+
},
4413+
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
4414+
"type": "project",
4415+
"framework": ".NETStandard,Version=v1.6",
4416+
"dependencies": {
4417+
"MyTested.AspNetCore.Mvc.Controllers": "1.0.0",
4418+
"MyTested.AspNetCore.Mvc.Routing": "1.0.0"
4419+
},
44084420
"compile": {
44094421
"netstandard1.6/MyTested.AspNetCore.Mvc.Core.dll": {}
44104422
},
@@ -4457,6 +4469,7 @@
44574469
"type": "project",
44584470
"framework": ".NETStandard,Version=v1.6",
44594471
"dependencies": {
4472+
"Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0",
44604473
"MyTested.AspNetCore.Mvc.Abstractions": "1.0.0"
44614474
},
44624475
"compile": {
@@ -6802,14 +6815,26 @@
68026815
"net451/MyTested.AspNetCore.Mvc.Configuration.dll": {}
68036816
}
68046817
},
6805-
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
6818+
"MyTested.AspNetCore.Mvc.Controllers/1.0.0-preview-final": {
68066819
"type": "project",
68076820
"framework": ".NETFramework,Version=v4.5.1",
68086821
"dependencies": {
6809-
"Microsoft.AspNetCore.Mvc.Core": "1.0.0",
6810-
"Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0",
68116822
"MyTested.AspNetCore.Mvc.Abstractions": "1.0.0"
68126823
},
6824+
"compile": {
6825+
"net451/MyTested.AspNetCore.Mvc.Controllers.dll": {}
6826+
},
6827+
"runtime": {
6828+
"net451/MyTested.AspNetCore.Mvc.Controllers.dll": {}
6829+
}
6830+
},
6831+
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
6832+
"type": "project",
6833+
"framework": ".NETFramework,Version=v4.5.1",
6834+
"dependencies": {
6835+
"MyTested.AspNetCore.Mvc.Controllers": "1.0.0",
6836+
"MyTested.AspNetCore.Mvc.Routing": "1.0.0"
6837+
},
68136838
"compile": {
68146839
"net451/MyTested.AspNetCore.Mvc.Core.dll": {}
68156840
},
@@ -6862,6 +6887,7 @@
68626887
"type": "project",
68636888
"framework": ".NETFramework,Version=v4.5.1",
68646889
"dependencies": {
6890+
"Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0",
68656891
"MyTested.AspNetCore.Mvc.Abstractions": "1.0.0"
68666892
},
68676893
"compile": {
@@ -13569,6 +13595,11 @@
1356913595
"path": "../../../src/MyTested.AspNetCore.Mvc.Configuration/project.json",
1357013596
"msbuildProject": "../../../src/MyTested.AspNetCore.Mvc.Configuration/MyTested.AspNetCore.Mvc.Configuration.xproj"
1357113597
},
13598+
"MyTested.AspNetCore.Mvc.Controllers/1.0.0-preview-final": {
13599+
"type": "project",
13600+
"path": "../../../src/MyTested.AspNetCore.Mvc.Controllers/project.json",
13601+
"msbuildProject": "../../../src/MyTested.AspNetCore.Mvc.Controllers/MyTested.AspNetCore.Mvc.Controllers.xproj"
13602+
},
1357213603
"MyTested.AspNetCore.Mvc.Core/1.0.0-preview-final": {
1357313604
"type": "project",
1357413605
"path": "../../../src/MyTested.AspNetCore.Mvc.Core/project.json",
File renamed without changes.

src/MyTested.AspNetCore.Mvc.Abstractions/Internal/Routing/CoreRouteResolver.cs renamed to src/MyTested.AspNetCore.Mvc.Abstractions/Internal/Routing/MvcRouteResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/// <summary>
1717
/// Used for resolving HTTP request to a route.
1818
/// </summary>
19-
public static class CoreRouteResolver
19+
public static class MvcRouteResolver
2020
{
2121
/// <summary>
2222
/// Resolves HTTP request to a route using the provided route context and the action selector and invoker services.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace MyTested.AspNetCore.Mvc.Plugins
2+
{
3+
using System;
4+
using Internal.Contracts;
5+
using Microsoft.Extensions.DependencyInjection;
6+
7+
public class AbstractionsTestPlugin : BaseTestPlugin, IServiceRegistrationPlugin, IInitializationPlugin
8+
{
9+
public Action<IServiceCollection> ServiceRegistrationDelegate =>
10+
serviceCollection => serviceCollection.AddCoreTesting();
11+
12+
// this call prepares all application conventions and fills the controller action descriptor cache
13+
public Action<IServiceProvider> InitializationDelegate => serviceProvider => serviceProvider.GetService<IControllerActionDescriptorCache>();
14+
}
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace MyTested.AspNetCore.Mvc.Plugins
2+
{
3+
using System;
4+
using Microsoft.AspNetCore.Mvc.Internal;
5+
using Microsoft.Extensions.DependencyInjection;
6+
7+
public abstract class BaseTestPlugin
8+
{
9+
private readonly Type defaultMvcMarkerServiceType = typeof(MvcMarkerService);
10+
11+
public Func<ServiceDescriptor, bool> ServiceSelectorPredicate =>
12+
serviceDescriptor => serviceDescriptor.ServiceType == defaultMvcMarkerServiceType;
13+
}
14+
}

src/MyTested.AspNetCore.Mvc.Abstractions/ServiceCollectionExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
6+
using Internal.Caching;
7+
using Internal.Contracts;
68
using Internal.Services;
79
using Microsoft.Extensions.DependencyInjection;
810
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -14,6 +16,13 @@
1416
/// </summary>
1517
public static class ServiceCollectionExtensions
1618
{
19+
public static IServiceCollection AddCoreTesting(this IServiceCollection serviceCollection)
20+
{
21+
CommonValidator.CheckForNullReference(serviceCollection, nameof(serviceCollection));
22+
serviceCollection.TryAddSingleton<IControllerActionDescriptorCache, ControllerActionDescriptorCache>();
23+
return serviceCollection;
24+
}
25+
1726
/// <summary>
1827
/// Removes а service from the <see cref="IServiceCollection"/>.
1928
/// </summary>

0 commit comments

Comments
 (0)