Skip to content

Refactor tests #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
355083c
Refactored tests for HttpReadOnly/NoHttpPost/Patch/Delete controller …
Jan 26, 2021
90274c6
Refactored tests for casing convention
Jan 26, 2021
4bdb3e8
Refactored tests for custom exception handler
Jan 26, 2021
cbe01c2
Refactored tests for nulls/default query string parameters; removed s…
Jan 26, 2021
0c5d5e8
Refactored tests for DisableQueryStringAttribute
Jan 27, 2021
7057c89
Refactored tests for resource injection
Jan 28, 2021
8756f25
Fixed assertions on DateTime/DateTimeOffset in tests
Jan 28, 2021
44653f8
Refactored tests for non-json:api controllers
Jan 28, 2021
22738b6
Refactored tests for ActionResult usage
Jan 28, 2021
e12d27f
Refactored tests for custom routes
Feb 2, 2021
ddcd4ac
Refactored tests for links rendering
Feb 2, 2021
8b443d8
Refactored tests for exception handling in serializer
Feb 2, 2021
64e09db
Refactored tests for serialization
Feb 2, 2021
8bf0989
Refactored tests for resource hooks
Feb 2, 2021
255ed36
General cleanup
Feb 3, 2021
c7000b8
Extracted test building blocks in shared project
Feb 4, 2021
db9778e
Auto-adjust namespaces
Feb 4, 2021
d9a2ac7
Refactored tests for service discovery
Feb 4, 2021
53f8c82
Refactored tests for no EF Core
Feb 4, 2021
86bac20
Renamed IntegrationTestContext to ExampleIntegrationTestContext becau…
Feb 4, 2021
d94235d
Adjusted test names for ModelStateValidationTests
Feb 4, 2021
c8a6012
Adjusted test names for pagination
Feb 4, 2021
cb983b9
Adjusted test names for meta
Feb 4, 2021
5ad5c76
Fixed broken tests; simpler bootstrap setup
Feb 4, 2021
838a158
Adjusted test names for hooks
Feb 4, 2021
d3ff09a
Enable concurrent testruns (makes running all tests 60% faster)
Feb 4, 2021
64c5b4a
Removed unused using
Feb 4, 2021
e2a2bb0
Merge branch 'master' into refactor-tests
Feb 4, 2021
bcb7320
Cleanup tests for hooks
Feb 4, 2021
60ac856
Cleanup example models
Feb 4, 2021
de40fb7
Revert "Enable concurrent testruns (makes running all tests 60% faste…
Feb 4, 2021
bd11b52
fixed failing testrunner
Feb 4, 2021
b0ac024
Enable running integration tests in parallel
Feb 4, 2021
f343d08
test
Feb 4, 2021
38c127a
Disable duplicate builds
Feb 4, 2021
9ee3fc5
Revert "Disable duplicate builds"
Feb 4, 2021
59fccd8
Addressed review feedback
Feb 5, 2021
21b94c5
Moved integration tests for filter/include/page/sort/fields into Quer…
Feb 5, 2021
a044cf0
Move types into separate files
Feb 5, 2021
78bc0c3
Moved unit tests for query string parameters into ExampleTests projec…
Feb 5, 2021
c2da909
Refactored query string integration tests to use private models. Chan…
Feb 5, 2021
e594391
Refactored query string unit tests to use private models.
Feb 5, 2021
f2fd733
Cleanup models in example project
Feb 6, 2021
f97b81f
Addressed review feedback
Feb 8, 2021
2516d2e
Rename
Feb 8, 2021
114dc07
Refactored tests for logging
Feb 8, 2021
37487cf
Refactored tests for meta
Feb 8, 2021
ea404bf
renamed ResourceHook tests and fixed a few wrong assertions
maurei Feb 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions JsonApiDotNetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiDbContextExample", "sr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiDbContextTests", "test\MultiDbContextTests\MultiDbContextTests.csproj", "{EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestBuildingBlocks", "test\TestBuildingBlocks\TestBuildingBlocks.csproj", "{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -199,6 +201,18 @@ Global
{EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA}.Release|x64.Build.0 = Release|Any CPU
{EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA}.Release|x86.ActiveCfg = Release|Any CPU
{EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA}.Release|x86.Build.0 = Release|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Debug|x64.ActiveCfg = Debug|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Debug|x64.Build.0 = Debug|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Debug|x86.ActiveCfg = Debug|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Debug|x86.Build.0 = Debug|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Release|Any CPU.Build.0 = Release|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Release|x64.ActiveCfg = Release|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Release|x64.Build.0 = Release|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Release|x86.ActiveCfg = Release|Any CPU
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -216,6 +230,7 @@ Global
{21D27239-138D-4604-8E49-DCBE41BCE4C8} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
{6CAFDDBE-00AB-4784-801B-AB419C3C3A26} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
{EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2421882-8F0A-4905-928F-B550B192F9A4}
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/extensibility/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The next option is to use the ActionFilter attributes that ship with the library
- `HttpReadOnly`: all of the above

Not only does this reduce boilerplate, but it also provides a more meaningful HTTP response code.
An attempt to use one blacklisted methods will result in a HTTP 405 Method Not Allowed response.
An attempt to use one of the blacklisted methods will result in a HTTP 405 Method Not Allowed response.

```c#
[HttpReadOnly]
Expand Down
4 changes: 2 additions & 2 deletions src/Examples/GettingStarted/Data/SampleDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public SampleDbContext(DbContextOptions<SampleDbContext> options)
{
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
protected override void OnModelCreating(ModelBuilder builder)
{
modelBuilder.Entity<Person>();
builder.Entity<Person>();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace JsonApiDotNetCoreExample.Controllers
{
[Route("[controller]")]
public sealed class NonJsonApiController : ControllerBase
{
[HttpGet]
public IActionResult Get()
{
var result = new[] {"Welcome!"};
return Ok(result);
}

[HttpPost]
public async Task<IActionResult> PostAsync()
{
string name = await new StreamReader(Request.Body).ReadToEndAsync();

if (string.IsNullOrEmpty(name))
{
return BadRequest("Please send your name.");
}

var result = "Hello, " + name;
return Ok(result);
}

[HttpPut]
public IActionResult Put([FromBody] string name)
{
var result = "Hi, " + name;
return Ok(result);
}

[HttpPatch]
public IActionResult Patch(string name)
{
var result = "Good day, " + name;
return Ok(result);
}

[HttpDelete]
public IActionResult Delete()
{
return Ok("Bye.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace JsonApiDotNetCoreExample.Controllers
{
public sealed class PassportsController : JsonApiController<Passport>
{
public PassportsController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<Passport, int> resourceService)
public PassportsController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<Passport> resourceService)
: base(options, loggerFactory, resourceService)
{
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading