diff --git a/.appveyor.yml b/.appveyor.yml index 32b79b18f..fc971fb1a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,7 +4,7 @@ branches: - master - development - ^version-.*$ -image: Visual Studio 2019 Preview +image: Visual Studio 2019 configuration: Release clone_depth: 1 before_build: diff --git a/.travis.yml b/.travis.yml index fb6841485..ba004e1b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,45 @@ language: csharp +mono: none +git: + depth: 10 +group: travis_latest sudo: required -dist: trusty -dotnet: 2.1.700 +dotnet: 2.2 solution: MyTested.AspNetCore.Mvc.sln -mono: none -os: -- linux -- osx -osx_image: xcode9.4 +env: + global: + - DOTNET_CLI_TELEMETRY_OPTOUT: 1 + - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + - NET_CORE_VERSION: netcoreapp2.2 +matrix: + fast_finish: true + include: + - os: linux + dist: xenial + - os: osx + dotnet: 2.2.300 + osx_image: xcode10.2 branches: only: - master - development - ^version-.*$ script: - - dotnet test "samples/MusicStore/MusicStore.Test/MusicStore.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Blog/Blog.Test/Blog.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/ApplicationParts/ApplicationParts.Test/ApplicationParts.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Autofac/Autofac.AssemblyInit.Test/Autofac.AssemblyInit.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Autofac/Autofac.NoContainerBuilder.Test/Autofac.NoContainerBuilder.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Autofac/Autofac.Test/Autofac.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.Core.MissingAppPackage/Test.Core.MissingAppPackage.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.DifferentEnvironment/Test.DifferentEnvironment.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.ExplicitNoStartupType/Test.ExplicitNoStartupType.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.MissingStartupType/Test.MissingStartupType.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.NoAsync/Test.NoAsync.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.NoStartupType/Test.NoStartupType.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.WrongStartupType/Test.WrongStartupType.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.WrongTestAssembly/Test.WrongTestAssembly.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Configuration/Test.WrongWebAssembly/Test.WrongWebAssembly.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/Lite/Lite.Test/Lite.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/NoStartup/NoStartup.Test/NoStartup.Test.csproj" --configuration Release --framework netcoreapp2.1 - - dotnet test "samples/WebStartup/WebStartup.Test/WebStartup.Test.csproj" --configuration Release --framework netcoreapp2.1 + - dotnet test "samples/MusicStore/MusicStore.Test/MusicStore.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Blog/Blog.Test/Blog.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/ApplicationParts/ApplicationParts.Test/ApplicationParts.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Autofac/Autofac.AssemblyInit.Test/Autofac.AssemblyInit.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Autofac/Autofac.NoContainerBuilder.Test/Autofac.NoContainerBuilder.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Autofac/Autofac.Test/Autofac.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.Core.MissingAppPackage/Test.Core.MissingAppPackage.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.DifferentEnvironment/Test.DifferentEnvironment.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.ExplicitNoStartupType/Test.ExplicitNoStartupType.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.MissingStartupType/Test.MissingStartupType.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.NoAsync/Test.NoAsync.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.NoStartupType/Test.NoStartupType.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.WrongStartupType/Test.WrongStartupType.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.WrongTestAssembly/Test.WrongTestAssembly.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Configuration/Test.WrongWebAssembly/Test.WrongWebAssembly.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/Lite/Lite.Test/Lite.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/NoStartup/NoStartup.Test/NoStartup.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" + - dotnet test "samples/WebStartup/WebStartup.Test/WebStartup.Test.csproj" --configuration Release --framework "$NET_CORE_VERSION" diff --git a/MyTested.AspNetCore.Mvc.sln b/MyTested.AspNetCore.Mvc.sln index cafedd20c..3d9ce51c8 100644 --- a/MyTested.AspNetCore.Mvc.sln +++ b/MyTested.AspNetCore.Mvc.sln @@ -231,6 +231,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyTested.AspNetCore.Mvc.Con EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyTested.AspNetCore.Mvc.ViewComponents.Results.Test", "test\MyTested.AspNetCore.Mvc.ViewComponents.Results.Test\MyTested.AspNetCore.Mvc.ViewComponents.Results.Test.csproj", "{32B24AD2-9D35-4A5A-86CE-8C7862DED27E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Core.MissingWebSdk", "samples\Configuration\Test.Core.MissingWebSdk\Test.Core.MissingWebSdk.csproj", "{E88A7195-A252-4C51-8255-6442ADD67874}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -645,6 +647,10 @@ Global {32B24AD2-9D35-4A5A-86CE-8C7862DED27E}.Debug|Any CPU.Build.0 = Debug|Any CPU {32B24AD2-9D35-4A5A-86CE-8C7862DED27E}.Release|Any CPU.ActiveCfg = Release|Any CPU {32B24AD2-9D35-4A5A-86CE-8C7862DED27E}.Release|Any CPU.Build.0 = Release|Any CPU + {E88A7195-A252-4C51-8255-6442ADD67874}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E88A7195-A252-4C51-8255-6442ADD67874}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E88A7195-A252-4C51-8255-6442ADD67874}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E88A7195-A252-4C51-8255-6442ADD67874}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -761,6 +767,7 @@ Global {03CFC257-39A4-4FFE-8FB5-AB43D055DFE8} = {D140FA14-A6C2-4279-8A41-35BC55279DA8} {4E038FA2-52FA-47CD-8797-6FD6CAE8741E} = {D140FA14-A6C2-4279-8A41-35BC55279DA8} {32B24AD2-9D35-4A5A-86CE-8C7862DED27E} = {D140FA14-A6C2-4279-8A41-35BC55279DA8} + {E88A7195-A252-4C51-8255-6442ADD67874} = {7BEC9808-8650-4322-BCC6-1D7D91B53678} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {99A2DEDD-5195-4EE6-A546-B1CA54C5539F} diff --git a/README.md b/README.md index fa8bc0798..15ca29ec8 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ *Downloads:* [![NuGet Badge](https://buildstats.info/nuget/MyTested.AspNetCore.Mvc)](https://www.nuget.org/packages/MyTested.AspNetCore.Mvc/) - + -**MyTested.AspNetCore.Mvc** has [more than 500 assertion methods](https://MyTestedASP.NET/Core/Mvc/Features) and is 100% covered by [more than 2000 unit tests](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.1/test). It should work correctly. Almost all items in the [issues page](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/issues) are expected future features and enhancements. +**MyTested.AspNetCore.Mvc** has [more than 500 assertion methods](https://MyTestedASP.NET/Core/Mvc/Features) and is 100% covered by [more than 2000 unit tests](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.2/test). It should work correctly. Almost all items in the [issues page](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/issues) are expected future features and enhancements. **MyTested.AspNetCore.Mvc** helps you speed up the testing process in your web development team! If you find that statement unbelievable, these are the words which some of the many happy **MyTested.AspNetCore.Mvc** users once said: > "I’ve been using your packages for almost 3 years now and it has saved me countless hours in creating unit tests and wanted to thank you for making this. I cannot imagine how much code I would have had to write to create the 450+ and counting unit tests I have for my controllers." @@ -95,15 +95,15 @@ To add **MyTested.AspNetCore.Mvc** to your solution, you must follow these simpl - netcoreapp2.1 + netcoreapp2.2 - - - - + + + + @@ -159,17 +159,17 @@ namespace MyApp.Tests.Controllers } ``` -Basically, **MyTested.AspNetCore.Mvc** throws an unhandled exception with a friendly error message if the assertion does not pass and the test fails. The example uses [xUnit](http://xunit.github.io/), but you can use any other framework you like. See the [samples](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.1/samples) for other types of test runners and `Startup` class configurations. +Basically, **MyTested.AspNetCore.Mvc** throws an unhandled exception with a friendly error message if the assertion does not pass and the test fails. The example uses [xUnit](http://xunit.github.io/), but you can use any other framework you like. See the [samples](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.2/samples) for other types of test runners and `Startup` class configurations. ## Detailed Documentation It is **strongly advised** to read the [tutorial](http://docs.mytestedasp.net/tutorial/intro.html) to get familiar with **MyTested.AspNetCore.Mvc** in more details. Additionally, you may see the [testing guide](http://docs.mytestedasp.net/guide/intro.html) or the [API reference](http://docs.mytestedasp.net/api/index.html) for a full list of available features. -You can also check out the [provided samples](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.1/samples) for real-life ASP.NET Core MVC application testing. +You can also check out the [provided samples](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.2/samples) for real-life ASP.NET Core MVC application testing. ## Package Installation -You can install this library using [NuGet](https://www.nuget.org/packages/MyTested.AspNetCore.Mvc.Universe) into your test project (or reference it directly in your `.csproj` file). Currently **MyTested.AspNetCore.Mvc** is fully compatible with ASP.NET Core MVC 2.1.0 and all older versions available on the official NuGet feed. +You can install this library using [NuGet](https://www.nuget.org/packages/MyTested.AspNetCore.Mvc.Universe) into your test project (or reference it directly in your `.csproj` file). Currently **MyTested.AspNetCore.Mvc** is fully compatible with ASP.NET Core MVC 2.2.0 and all older versions available on the official NuGet feed. ```powershell Install-Package MyTested.AspNetCore.Mvc.Universe @@ -214,7 +214,7 @@ using MyTested.AspNetCore.Mvc; Here are some examples of how **powerful** the fluent testing API actually is! -**MyTested.AspNetCore.Mvc** is so **awesome** that each test can be written in **one single line** like in this [application sample](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.1/samples/Blog)! +**MyTested.AspNetCore.Mvc** is so **awesome** that each test can be written in **one single line** like in this [application sample](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/version-2.2/samples/Blog)! ### Controller Integration Tests @@ -281,7 +281,6 @@ MyController // and tests for added by the action temp data entry with а specific key, // and tests for redirect result to a specific action. MyController - .Instance() .Calling(c => c.MyAction(new MyFormModel { Title = title, @@ -409,7 +408,6 @@ MyController // Tests for specific action attributes - HttpGet, AllowAnonymous, ValidateAntiForgeryToken, and ActionName. MyController - .Instance() .Calling(c => c.MyAction(With.Empty())) // Provides no value for the action parameter. .ShouldHave() .ActionAttributes(attributes => attributes @@ -566,7 +564,7 @@ MyMvc ## Versioning -**MyTested.AspNetCore.Mvc** follows the ASP.NET Core MVC versions with which the testing framework is fully compatible. Specifically, the *major* and the *minor* versions will be incremented only when the MVC framework has a new official release. For example, version 2.1.\* of the testing framework is fully compatible with ASP.NET Core MVC 2.1.\*, version 1.1.\* is fully compatible with ASP.NET Core MVC 1.1.\*, version 1.0.15 is fully compatible with ASP.NET Core MVC 1.0.\*, and so on. +**MyTested.AspNetCore.Mvc** follows the ASP.NET Core MVC versions with which the testing framework is fully compatible. Specifically, the *major* and the *minor* versions will be incremented only when the MVC framework has a new official release. For example, version 2.2.\* of the testing framework is fully compatible with ASP.NET Core MVC 2.2.\*, version 1.1.\* is fully compatible with ASP.NET Core MVC 1.1.\*, version 1.0.15 is fully compatible with ASP.NET Core MVC 1.0.\*, and so on. The public interface of **MyTested.AspNetCore.Mvc** will not have any breaking changes when the version increases (unless entirely necessary). @@ -580,7 +578,7 @@ The source code of **MyTested.AspNetCore.Mvc** and its extensions (the full vers Without a license code, the full version of the library allows up to 100 assertions (around 25 test cases) per test project. **MyTested.AspNetCore.Mvc versions before 3.0.0 do not have such restrictions and work without any limitations.** -**Full-featured license codes can be requested for free by individuals, open-source projects, startups, and educational institutions**. See [https://MyTestedASP.NET/Core/Mvc#free-usage](https://MyTestedASP.NET/Core/Mvc#free-usage) for more information. +**Full-featured license codes can be requested for free by small businesses (up to 5 developers), individuals, open-source projects, startups, and educational institutions**. See [https://MyTestedASP.NET/Core/Mvc#free-usage](https://MyTestedASP.NET/Core/Mvc#free-usage) for more information. Commercial licensing with premium support options is also available at [https://MyTestedASP.NET/Core/Mvc#pricing](https://MyTestedASP.NET/Core/Mvc#pricing). diff --git a/samples/ApplicationParts/ApplicationParts.Controllers/ApplicationParts.Controllers.csproj b/samples/ApplicationParts/ApplicationParts.Controllers/ApplicationParts.Controllers.csproj index 231e1a565..05a30e273 100644 --- a/samples/ApplicationParts/ApplicationParts.Controllers/ApplicationParts.Controllers.csproj +++ b/samples/ApplicationParts/ApplicationParts.Controllers/ApplicationParts.Controllers.csproj @@ -16,8 +16,8 @@ - - + + diff --git a/samples/ApplicationParts/ApplicationParts.Models/ApplicationParts.Models.csproj b/samples/ApplicationParts/ApplicationParts.Models/ApplicationParts.Models.csproj index b487efb03..a68273c9b 100644 --- a/samples/ApplicationParts/ApplicationParts.Models/ApplicationParts.Models.csproj +++ b/samples/ApplicationParts/ApplicationParts.Models/ApplicationParts.Models.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/samples/ApplicationParts/ApplicationParts.Test/ApplicationParts.Test.csproj b/samples/ApplicationParts/ApplicationParts.Test/ApplicationParts.Test.csproj index 4b600602a..81c34e130 100644 --- a/samples/ApplicationParts/ApplicationParts.Test/ApplicationParts.Test.csproj +++ b/samples/ApplicationParts/ApplicationParts.Test/ApplicationParts.Test.csproj @@ -1,7 +1,8 @@ - + - netcoreapp2.1 + netcoreapp2.2;net461 + true true @@ -15,10 +16,9 @@ - - - - + + + diff --git a/samples/ApplicationParts/ApplicationParts.Test/Properties/launchSettings.json b/samples/ApplicationParts/ApplicationParts.Test/Properties/launchSettings.json deleted file mode 100644 index 239efb11f..000000000 --- a/samples/ApplicationParts/ApplicationParts.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:50168/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "ApplicationParts.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:50169/" - } - } -} \ No newline at end of file diff --git a/samples/ApplicationParts/ApplicationParts.Web/ApplicationParts.Web.csproj b/samples/ApplicationParts/ApplicationParts.Web/ApplicationParts.Web.csproj index 15b17d631..ab992468f 100644 --- a/samples/ApplicationParts/ApplicationParts.Web/ApplicationParts.Web.csproj +++ b/samples/ApplicationParts/ApplicationParts.Web/ApplicationParts.Web.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 ApplicationParts.Web aspnet-ApplicationParts.Web-c273a372-79ef-490d-b0e1-a7fb8f2dacc7 true @@ -18,28 +18,28 @@ - - - - - - - - - - - - + + + + + + + + + + + + all runtime; build; native; contentfiles; analyzers - - - - - - - + + + + + + + diff --git a/samples/Autofac/Autofac.AssemblyInit.Test/Autofac.AssemblyInit.Test.csproj b/samples/Autofac/Autofac.AssemblyInit.Test/Autofac.AssemblyInit.Test.csproj index 0a15a90b7..dbf1eba4c 100644 --- a/samples/Autofac/Autofac.AssemblyInit.Test/Autofac.AssemblyInit.Test.csproj +++ b/samples/Autofac/Autofac.AssemblyInit.Test/Autofac.AssemblyInit.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,9 @@ - - - + + + diff --git a/samples/Autofac/Autofac.AssemblyInit.Test/Properties/launchSettings.json b/samples/Autofac/Autofac.AssemblyInit.Test/Properties/launchSettings.json deleted file mode 100644 index f42bb1f54..000000000 --- a/samples/Autofac/Autofac.AssemblyInit.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:56881/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Autofac.AssemblyInit.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:56882/" - } - } -} \ No newline at end of file diff --git a/samples/Autofac/Autofac.NoContainerBuilder.Test/Autofac.NoContainerBuilder.Test.csproj b/samples/Autofac/Autofac.NoContainerBuilder.Test/Autofac.NoContainerBuilder.Test.csproj index 3ce28e739..85a5e2651 100644 --- a/samples/Autofac/Autofac.NoContainerBuilder.Test/Autofac.NoContainerBuilder.Test.csproj +++ b/samples/Autofac/Autofac.NoContainerBuilder.Test/Autofac.NoContainerBuilder.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Autofac/Autofac.NoContainerBuilder.Test/Properties/launchSettings.json b/samples/Autofac/Autofac.NoContainerBuilder.Test/Properties/launchSettings.json deleted file mode 100644 index 0b011da7e..000000000 --- a/samples/Autofac/Autofac.NoContainerBuilder.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:64975/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Autofac.NoContainerBuilder.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:64976/" - } - } -} \ No newline at end of file diff --git a/samples/Autofac/Autofac.NoContainerBuilder.Web/Autofac.NoContainerBuilder.Web.csproj b/samples/Autofac/Autofac.NoContainerBuilder.Web/Autofac.NoContainerBuilder.Web.csproj index cd8926e67..db67400af 100644 --- a/samples/Autofac/Autofac.NoContainerBuilder.Web/Autofac.NoContainerBuilder.Web.csproj +++ b/samples/Autofac/Autofac.NoContainerBuilder.Web/Autofac.NoContainerBuilder.Web.csproj @@ -1,14 +1,14 @@  - netcoreapp2.1 + netcoreapp2.2 InProcess true - + diff --git a/samples/Autofac/Autofac.NoContainerBuilder.Web/Startup.cs b/samples/Autofac/Autofac.NoContainerBuilder.Web/Startup.cs index 44bbd4963..fa53df92a 100644 --- a/samples/Autofac/Autofac.NoContainerBuilder.Web/Startup.cs +++ b/samples/Autofac/Autofac.NoContainerBuilder.Web/Startup.cs @@ -28,7 +28,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services) services.AddSingleton(_ => new DateTimeService()); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); var builder = this.GetContainerBuilder(services); diff --git a/samples/Autofac/Autofac.Test/Autofac.Test.csproj b/samples/Autofac/Autofac.Test/Autofac.Test.csproj index 9e643d3cf..e9f234faa 100644 --- a/samples/Autofac/Autofac.Test/Autofac.Test.csproj +++ b/samples/Autofac/Autofac.Test/Autofac.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Autofac/Autofac.Test/Properties/launchSettings.json b/samples/Autofac/Autofac.Test/Properties/launchSettings.json deleted file mode 100644 index 293d738bb..000000000 --- a/samples/Autofac/Autofac.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:59617/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Autofac.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:59618/" - } - } -} \ No newline at end of file diff --git a/samples/Autofac/Autofac.Web/Autofac.Web.csproj b/samples/Autofac/Autofac.Web/Autofac.Web.csproj index 8a1906e07..93d01010b 100644 --- a/samples/Autofac/Autofac.Web/Autofac.Web.csproj +++ b/samples/Autofac/Autofac.Web/Autofac.Web.csproj @@ -1,13 +1,13 @@  - netcoreapp2.1 + netcoreapp2.2 InProcess true - + diff --git a/samples/Autofac/Autofac.Web/Startup.cs b/samples/Autofac/Autofac.Web/Startup.cs index 7c4da5b15..89020a8f8 100644 --- a/samples/Autofac/Autofac.Web/Startup.cs +++ b/samples/Autofac/Autofac.Web/Startup.cs @@ -26,7 +26,7 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(_ => new DateTimeService()); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } public void ConfigureContainer(ContainerBuilder builder) diff --git a/samples/Blog/Blog.Controllers/Blog.Controllers.csproj b/samples/Blog/Blog.Controllers/Blog.Controllers.csproj index 485d47daa..00ec480f3 100644 --- a/samples/Blog/Blog.Controllers/Blog.Controllers.csproj +++ b/samples/Blog/Blog.Controllers/Blog.Controllers.csproj @@ -6,7 +6,7 @@ - + diff --git a/samples/Blog/Blog.Data/Blog.Data.csproj b/samples/Blog/Blog.Data/Blog.Data.csproj index 1466bf5dc..191710c9d 100644 --- a/samples/Blog/Blog.Data/Blog.Data.csproj +++ b/samples/Blog/Blog.Data/Blog.Data.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/samples/Blog/Blog.Services/Blog.Services.csproj b/samples/Blog/Blog.Services/Blog.Services.csproj index 98738023a..b32af7752 100644 --- a/samples/Blog/Blog.Services/Blog.Services.csproj +++ b/samples/Blog/Blog.Services/Blog.Services.csproj @@ -6,7 +6,7 @@ - + diff --git a/samples/Blog/Blog.Test/Blog.Test.csproj b/samples/Blog/Blog.Test/Blog.Test.csproj index dca2a92ef..b8141d25e 100644 --- a/samples/Blog/Blog.Test/Blog.Test.csproj +++ b/samples/Blog/Blog.Test/Blog.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true @@ -17,8 +17,8 @@ - - + + diff --git a/samples/Blog/Blog.Test/Properties/launchSettings.json b/samples/Blog/Blog.Test/Properties/launchSettings.json deleted file mode 100644 index 65cecd544..000000000 --- a/samples/Blog/Blog.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:61554/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Blog.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:61555/" - } - } -} \ No newline at end of file diff --git a/samples/Blog/Blog.Web/Blog.Web.csproj b/samples/Blog/Blog.Web/Blog.Web.csproj index 0831456d2..da8d5e236 100644 --- a/samples/Blog/Blog.Web/Blog.Web.csproj +++ b/samples/Blog/Blog.Web/Blog.Web.csproj @@ -1,16 +1,16 @@  - netcoreapp2.1 + netcoreapp2.2 aspnet-Blog.Web-6757ED6F-7F48-4961-917B-ADA8F5DEAFB4 InProcess true - + - + diff --git a/samples/Blog/Blog.Web/Startup.cs b/samples/Blog/Blog.Web/Startup.cs index 899a062f7..24292e37a 100644 --- a/samples/Blog/Blog.Web/Startup.cs +++ b/samples/Blog/Blog.Web/Startup.cs @@ -1,6 +1,7 @@ namespace Blog.Web { using AutoMapper; + using Controllers; using Data; using Data.Models; using Infrastructure; @@ -9,7 +10,6 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; - using Microsoft.AspNetCore.Identity.UI; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; @@ -51,17 +51,18 @@ public void ConfigureServices(IServiceCollection services) options.Password.RequireUppercase = false; }); - services.AddAutoMapper(typeof(IArticleService).Assembly); + services.AddAutoMapper( + typeof(IArticleService).Assembly, + typeof(HomeController).Assembly); - services.AddTransient(); - services.AddTransient(); + services + .AddTransient() + .AddTransient(); services - .AddMvc(options => - { - options.AddAutoValidateAntiforgeryToken(); - }) - .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + .AddMvc(options => options + .AddAutoValidateAntiforgeryToken()) + .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) diff --git a/samples/Configuration/Test.Core.MissingAppPackage/Properties/launchSettings.json b/samples/Configuration/Test.Core.MissingAppPackage/Properties/launchSettings.json deleted file mode 100644 index 75d1b6c53..000000000 --- a/samples/Configuration/Test.Core.MissingAppPackage/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:49651/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.Core.MissingAppPackage": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:49653/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.Core.MissingAppPackage/Test.Core.MissingAppPackage.csproj b/samples/Configuration/Test.Core.MissingAppPackage/Test.Core.MissingAppPackage.csproj index 0655ac134..058c05aea 100644 --- a/samples/Configuration/Test.Core.MissingAppPackage/Test.Core.MissingAppPackage.csproj +++ b/samples/Configuration/Test.Core.MissingAppPackage/Test.Core.MissingAppPackage.csproj @@ -1,16 +1,19 @@  - netcoreapp2.1 + netcoreapp2.2 true false - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.Core.MissingWebSdk/HomeControllerTest.cs b/samples/Configuration/Test.Core.MissingWebSdk/HomeControllerTest.cs new file mode 100644 index 000000000..6e30039fd --- /dev/null +++ b/samples/Configuration/Test.Core.MissingWebSdk/HomeControllerTest.cs @@ -0,0 +1,25 @@ +namespace Test.Core.MissingWebSdk +{ + using System; + using MyTested.AspNetCore.Mvc; + using WebApplication.Controllers; + using Xunit; + + public class HomeControllerTest + { + [Fact] + public void MissingSdkShouldThrowCorrectException() + { + var exception = Assert.Throws(() => + { + MyController + .Instance() + .Calling(c => c.Index()) + .ShouldReturn() + .View(); + }); + + Assert.Equal("HomeController is not recognized as a valid controller type. Classes decorated with 'NonControllerAttribute' are not considered as passable controllers. Additionally, make sure the SDK is set to 'Microsoft.NET.Sdk.Web' in your test project's '.csproj' file in order to enable proper controller discovery. If your type is still not recognized, you may manually add it in the application part manager by using the 'AddMvc().PartManager.ApplicationParts.Add(applicationPart))' method.", exception.Message); + } + } +} \ No newline at end of file diff --git a/samples/Configuration/Test.Core.MissingWebSdk/Properties/AssemblyInfo.cs b/samples/Configuration/Test.Core.MissingWebSdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..c6e3a385b --- /dev/null +++ b/samples/Configuration/Test.Core.MissingWebSdk/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +using System.Runtime.InteropServices; +using Xunit; + +[assembly: ComVisible(false)] + +[assembly: CollectionBehavior(MaxParallelThreads = -1)] diff --git a/samples/Configuration/Test.Core.MissingWebSdk/Test.Core.MissingWebSdk.csproj b/samples/Configuration/Test.Core.MissingWebSdk/Test.Core.MissingWebSdk.csproj new file mode 100644 index 000000000..192589f7d --- /dev/null +++ b/samples/Configuration/Test.Core.MissingWebSdk/Test.Core.MissingWebSdk.csproj @@ -0,0 +1,25 @@ + + + + netcoreapp2.2 + true + + false + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + \ No newline at end of file diff --git a/samples/Configuration/Test.Core.MissingWebSdk/TestStartup.cs b/samples/Configuration/Test.Core.MissingWebSdk/TestStartup.cs new file mode 100644 index 000000000..cc360b0d5 --- /dev/null +++ b/samples/Configuration/Test.Core.MissingWebSdk/TestStartup.cs @@ -0,0 +1,13 @@ +namespace Test.Core.MissingWebSdk +{ + using Microsoft.Extensions.Configuration; + using WebApplication.Core; + + public class TestStartup : Startup + { + public TestStartup(IConfiguration configuration) + : base(configuration) + { + } + } +} \ No newline at end of file diff --git a/samples/Configuration/Test.DifferentEnvironment/Properties/launchSettings.json b/samples/Configuration/Test.DifferentEnvironment/Properties/launchSettings.json deleted file mode 100644 index a17d86793..000000000 --- a/samples/Configuration/Test.DifferentEnvironment/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:50366/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.DifferentEnvironment": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:50368/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.DifferentEnvironment/Test.DifferentEnvironment.csproj b/samples/Configuration/Test.DifferentEnvironment/Test.DifferentEnvironment.csproj index 9621b0883..91068c040 100644 --- a/samples/Configuration/Test.DifferentEnvironment/Test.DifferentEnvironment.csproj +++ b/samples/Configuration/Test.DifferentEnvironment/Test.DifferentEnvironment.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.ExplicitNoStartupType/Properties/launchSettings.json b/samples/Configuration/Test.ExplicitNoStartupType/Properties/launchSettings.json deleted file mode 100644 index 4d4077cca..000000000 --- a/samples/Configuration/Test.ExplicitNoStartupType/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:62718/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.ExplicitNoStartupType": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:62719/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.ExplicitNoStartupType/Test.ExplicitNoStartupType.csproj b/samples/Configuration/Test.ExplicitNoStartupType/Test.ExplicitNoStartupType.csproj index 9621b0883..91068c040 100644 --- a/samples/Configuration/Test.ExplicitNoStartupType/Test.ExplicitNoStartupType.csproj +++ b/samples/Configuration/Test.ExplicitNoStartupType/Test.ExplicitNoStartupType.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.FullFramework.NoCompilationContext/Test.FullFramework.NoCompilationContext.csproj b/samples/Configuration/Test.FullFramework.NoCompilationContext/Test.FullFramework.NoCompilationContext.csproj index d0d22c24a..bd3a6b1bd 100644 --- a/samples/Configuration/Test.FullFramework.NoCompilationContext/Test.FullFramework.NoCompilationContext.csproj +++ b/samples/Configuration/Test.FullFramework.NoCompilationContext/Test.FullFramework.NoCompilationContext.csproj @@ -8,9 +8,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.MissingStartupType/Properties/launchSettings.json b/samples/Configuration/Test.MissingStartupType/Properties/launchSettings.json deleted file mode 100644 index 6083a20b1..000000000 --- a/samples/Configuration/Test.MissingStartupType/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:62040/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.MissingStartupType": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:62053/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.MissingStartupType/Test.MissingStartupType.csproj b/samples/Configuration/Test.MissingStartupType/Test.MissingStartupType.csproj index 850d54de3..a09cd10cc 100644 --- a/samples/Configuration/Test.MissingStartupType/Test.MissingStartupType.csproj +++ b/samples/Configuration/Test.MissingStartupType/Test.MissingStartupType.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.NoAsync/Properties/launchSettings.json b/samples/Configuration/Test.NoAsync/Properties/launchSettings.json deleted file mode 100644 index 41b13e171..000000000 --- a/samples/Configuration/Test.NoAsync/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:62846/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.NoAsync": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:62847/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.NoAsync/Test.NoAsync.csproj b/samples/Configuration/Test.NoAsync/Test.NoAsync.csproj index 9621b0883..91068c040 100644 --- a/samples/Configuration/Test.NoAsync/Test.NoAsync.csproj +++ b/samples/Configuration/Test.NoAsync/Test.NoAsync.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.NoStartupType/Properties/launchSettings.json b/samples/Configuration/Test.NoStartupType/Properties/launchSettings.json deleted file mode 100644 index 5d145c435..000000000 --- a/samples/Configuration/Test.NoStartupType/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:63066/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.NoStartupType": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:63067/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.NoStartupType/Test.NoStartupType.csproj b/samples/Configuration/Test.NoStartupType/Test.NoStartupType.csproj index 9621b0883..91068c040 100644 --- a/samples/Configuration/Test.NoStartupType/Test.NoStartupType.csproj +++ b/samples/Configuration/Test.NoStartupType/Test.NoStartupType.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.WrongStartupType/Properties/launchSettings.json b/samples/Configuration/Test.WrongStartupType/Properties/launchSettings.json deleted file mode 100644 index 5b20cb6e1..000000000 --- a/samples/Configuration/Test.WrongStartupType/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:56767/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.WrongStartupType": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:56768/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.WrongStartupType/Test.WrongStartupType.csproj b/samples/Configuration/Test.WrongStartupType/Test.WrongStartupType.csproj index 9621b0883..91068c040 100644 --- a/samples/Configuration/Test.WrongStartupType/Test.WrongStartupType.csproj +++ b/samples/Configuration/Test.WrongStartupType/Test.WrongStartupType.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.WrongTestAssembly/Properties/launchSettings.json b/samples/Configuration/Test.WrongTestAssembly/Properties/launchSettings.json deleted file mode 100644 index 192e5e673..000000000 --- a/samples/Configuration/Test.WrongTestAssembly/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:56532/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.WrongTestAssembly": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:56535/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.WrongTestAssembly/Test.WrongTestAssembly.csproj b/samples/Configuration/Test.WrongTestAssembly/Test.WrongTestAssembly.csproj index 9621b0883..91068c040 100644 --- a/samples/Configuration/Test.WrongTestAssembly/Test.WrongTestAssembly.csproj +++ b/samples/Configuration/Test.WrongTestAssembly/Test.WrongTestAssembly.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/Test.WrongWebAssembly/Properties/launchSettings.json b/samples/Configuration/Test.WrongWebAssembly/Properties/launchSettings.json deleted file mode 100644 index edad24559..000000000 --- a/samples/Configuration/Test.WrongWebAssembly/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:56618/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Test.WrongWebAssembly": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:56619/" - } - } -} \ No newline at end of file diff --git a/samples/Configuration/Test.WrongWebAssembly/Test.WrongWebAssembly.csproj b/samples/Configuration/Test.WrongWebAssembly/Test.WrongWebAssembly.csproj index 9621b0883..91068c040 100644 --- a/samples/Configuration/Test.WrongWebAssembly/Test.WrongWebAssembly.csproj +++ b/samples/Configuration/Test.WrongWebAssembly/Test.WrongWebAssembly.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true false @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/Configuration/WebApplication.Controllers/WebApplication.Controllers.csproj b/samples/Configuration/WebApplication.Controllers/WebApplication.Controllers.csproj index c694e43a6..dcca0c4dd 100644 --- a/samples/Configuration/WebApplication.Controllers/WebApplication.Controllers.csproj +++ b/samples/Configuration/WebApplication.Controllers/WebApplication.Controllers.csproj @@ -6,7 +6,7 @@ - + diff --git a/samples/Configuration/WebApplication.Core/Startup.cs b/samples/Configuration/WebApplication.Core/Startup.cs index fb7461c77..a6033a039 100644 --- a/samples/Configuration/WebApplication.Core/Startup.cs +++ b/samples/Configuration/WebApplication.Core/Startup.cs @@ -26,7 +26,7 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) diff --git a/samples/Configuration/WebApplication.Core/WebApplication.Core.csproj b/samples/Configuration/WebApplication.Core/WebApplication.Core.csproj index 008bc4d51..460d0e620 100644 --- a/samples/Configuration/WebApplication.Core/WebApplication.Core.csproj +++ b/samples/Configuration/WebApplication.Core/WebApplication.Core.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 InProcess true diff --git a/samples/Configuration/WebApplication.FullFramework/Startup.cs b/samples/Configuration/WebApplication.FullFramework/Startup.cs index 7287f60f4..836acef3b 100644 --- a/samples/Configuration/WebApplication.FullFramework/Startup.cs +++ b/samples/Configuration/WebApplication.FullFramework/Startup.cs @@ -26,7 +26,7 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) diff --git a/samples/Configuration/WebApplication.FullFramework/WebApplication.FullFramework.csproj b/samples/Configuration/WebApplication.FullFramework/WebApplication.FullFramework.csproj index e7914354b..218584b6a 100644 --- a/samples/Configuration/WebApplication.FullFramework/WebApplication.FullFramework.csproj +++ b/samples/Configuration/WebApplication.FullFramework/WebApplication.FullFramework.csproj @@ -7,11 +7,11 @@ - - - - - + + + + + diff --git a/samples/FullFramework/FullFramework.AssemblyInit.Test/FullFramework.AssemblyInit.Test.csproj b/samples/FullFramework/FullFramework.AssemblyInit.Test/FullFramework.AssemblyInit.Test.csproj index fca94e3f1..25a410bfc 100644 --- a/samples/FullFramework/FullFramework.AssemblyInit.Test/FullFramework.AssemblyInit.Test.csproj +++ b/samples/FullFramework/FullFramework.AssemblyInit.Test/FullFramework.AssemblyInit.Test.csproj @@ -19,10 +19,4 @@ - - - PreserveNewest - - - diff --git a/samples/FullFramework/FullFramework.AssemblyInit.Test/testconfig.json b/samples/FullFramework/FullFramework.AssemblyInit.Test/testconfig.json deleted file mode 100644 index 99adf5395..000000000 --- a/samples/FullFramework/FullFramework.AssemblyInit.Test/testconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "General": { - "AutomaticStartup": false - } -} diff --git a/samples/FullFramework/FullFramework.Test/FullFramework.Test.csproj b/samples/FullFramework/FullFramework.Test/FullFramework.Test.csproj index fdae42c4f..cedb82c5d 100644 --- a/samples/FullFramework/FullFramework.Test/FullFramework.Test.csproj +++ b/samples/FullFramework/FullFramework.Test/FullFramework.Test.csproj @@ -9,9 +9,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/samples/FullFramework/FullFramework.Test/Properties/launchSettings.json b/samples/FullFramework/FullFramework.Test/Properties/launchSettings.json deleted file mode 100644 index 16e64338f..000000000 --- a/samples/FullFramework/FullFramework.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:65509/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "FullFramework.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:65510/" - } - } -} \ No newline at end of file diff --git a/samples/FullFramework/FullFramework.Web/FullFramework.Web.csproj b/samples/FullFramework/FullFramework.Web/FullFramework.Web.csproj index f8621f6ce..3d9617ada 100644 --- a/samples/FullFramework/FullFramework.Web/FullFramework.Web.csproj +++ b/samples/FullFramework/FullFramework.Web/FullFramework.Web.csproj @@ -9,11 +9,11 @@ - - - - - + + + + + diff --git a/samples/FullFramework/FullFramework.Web/Startup.cs b/samples/FullFramework/FullFramework.Web/Startup.cs index 0e4f6a379..185b18e13 100644 --- a/samples/FullFramework/FullFramework.Web/Startup.cs +++ b/samples/FullFramework/FullFramework.Web/Startup.cs @@ -25,7 +25,7 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) diff --git a/samples/Lite/Lite.Test/Lite.Test.csproj b/samples/Lite/Lite.Test/Lite.Test.csproj index 0c8c3986e..e3e66e091 100644 --- a/samples/Lite/Lite.Test/Lite.Test.csproj +++ b/samples/Lite/Lite.Test/Lite.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true true @@ -12,13 +12,13 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/samples/Lite/Lite.Web/Lite.Web.csproj b/samples/Lite/Lite.Web/Lite.Web.csproj index 18c9e9e35..6071000e9 100644 --- a/samples/Lite/Lite.Web/Lite.Web.csproj +++ b/samples/Lite/Lite.Web/Lite.Web.csproj @@ -1,22 +1,22 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true - - - - - - - - - - - + + + + + + + + + + + diff --git a/samples/Lite/Lite.Web/web.config b/samples/Lite/Lite.Web/web.config index b56a4065f..3d49211e5 100644 --- a/samples/Lite/Lite.Web/web.config +++ b/samples/Lite/Lite.Web/web.config @@ -5,7 +5,7 @@ --> - + diff --git a/samples/MusicStore/MusicStore.Test/MusicStore.Test.csproj b/samples/MusicStore/MusicStore.Test/MusicStore.Test.csproj index cf4943d40..9a35aa782 100644 --- a/samples/MusicStore/MusicStore.Test/MusicStore.Test.csproj +++ b/samples/MusicStore/MusicStore.Test/MusicStore.Test.csproj @@ -1,13 +1,13 @@  - netcoreapp2.1 + netcoreapp2.2 true - + all diff --git a/samples/MusicStore/MusicStore.Test/Properties/launchSettings.json b/samples/MusicStore/MusicStore.Test/Properties/launchSettings.json deleted file mode 100644 index 71635caa2..000000000 --- a/samples/MusicStore/MusicStore.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:57437/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "MusicStore.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:57439/" - } - } -} \ No newline at end of file diff --git a/samples/MusicStore/MusicStore.Web/MusicStore.Web.csproj b/samples/MusicStore/MusicStore.Web/MusicStore.Web.csproj index a37e6db78..09e1ed66c 100644 --- a/samples/MusicStore/MusicStore.Web/MusicStore.Web.csproj +++ b/samples/MusicStore/MusicStore.Web/MusicStore.Web.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 aspnet-MusicStore.Web-B1796332-CD47-4D99-85BC-7F98EA978F33 InProcess MusicStore @@ -10,18 +10,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/samples/NoStartup/NoStartup.Components/NoStartup.Components.csproj b/samples/NoStartup/NoStartup.Components/NoStartup.Components.csproj index f30d429d0..6d0598174 100644 --- a/samples/NoStartup/NoStartup.Components/NoStartup.Components.csproj +++ b/samples/NoStartup/NoStartup.Components/NoStartup.Components.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/NoStartup/NoStartup.Controllers/NoStartup.Controllers.csproj b/samples/NoStartup/NoStartup.Controllers/NoStartup.Controllers.csproj index 756259507..fc64a98f1 100644 --- a/samples/NoStartup/NoStartup.Controllers/NoStartup.Controllers.csproj +++ b/samples/NoStartup/NoStartup.Controllers/NoStartup.Controllers.csproj @@ -11,7 +11,7 @@ - + diff --git a/samples/NoStartup/NoStartup.Test/NoStartup.Test.csproj b/samples/NoStartup/NoStartup.Test/NoStartup.Test.csproj index 42e658018..b4201ab71 100644 --- a/samples/NoStartup/NoStartup.Test/NoStartup.Test.csproj +++ b/samples/NoStartup/NoStartup.Test/NoStartup.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true true diff --git a/samples/NoStartup/NoStartup.Test/Properties/launchSettings.json b/samples/NoStartup/NoStartup.Test/Properties/launchSettings.json deleted file mode 100644 index 545c0e95b..000000000 --- a/samples/NoStartup/NoStartup.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:50183/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "NoStartup.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:50184/" - } - } -} \ No newline at end of file diff --git a/samples/NoStartup/NoStartup.Test/testconfig.json b/samples/NoStartup/NoStartup.Test/testconfig.json index cfd84433a..d683db7d7 100644 --- a/samples/NoStartup/NoStartup.Test/testconfig.json +++ b/samples/NoStartup/NoStartup.Test/testconfig.json @@ -1,6 +1,5 @@ { "General": { - "AutomaticStartup": false, "NoStartup": true } } diff --git a/samples/WebStartup/WebStartup.Test/Properties/launchSettings.json b/samples/WebStartup/WebStartup.Test/Properties/launchSettings.json deleted file mode 100644 index ca2b20a1b..000000000 --- a/samples/WebStartup/WebStartup.Test/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:64260/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "WebStartup.Test": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:64261/" - } - } -} \ No newline at end of file diff --git a/samples/WebStartup/WebStartup.Test/WebStartup.Test.csproj b/samples/WebStartup/WebStartup.Test/WebStartup.Test.csproj index 5c26eafd0..b17d6a4ac 100644 --- a/samples/WebStartup/WebStartup.Test/WebStartup.Test.csproj +++ b/samples/WebStartup/WebStartup.Test/WebStartup.Test.csproj @@ -1,13 +1,13 @@  - netcoreapp2.1 + netcoreapp2.2 true - + all diff --git a/samples/WebStartup/WebStartup.Web/Startup.cs b/samples/WebStartup/WebStartup.Web/Startup.cs index 09b51c3c3..ac7956d57 100644 --- a/samples/WebStartup/WebStartup.Web/Startup.cs +++ b/samples/WebStartup/WebStartup.Web/Startup.cs @@ -24,7 +24,7 @@ public void ConfigureServices(IServiceCollection services) options.MinimumSameSitePolicy = SameSiteMode.None; }); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/samples/WebStartup/WebStartup.Web/WebStartup.Web.csproj b/samples/WebStartup/WebStartup.Web/WebStartup.Web.csproj index 06d9707a7..51381d074 100644 --- a/samples/WebStartup/WebStartup.Web/WebStartup.Web.csproj +++ b/samples/WebStartup/WebStartup.Web/WebStartup.Web.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 InProcess true @@ -9,7 +9,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Abstractions/Internal/TestFramework.cs b/src/MyTested.AspNetCore.Mvc.Abstractions/Internal/TestFramework.cs index 2465d2f73..8209cf767 100644 --- a/src/MyTested.AspNetCore.Mvc.Abstractions/Internal/TestFramework.cs +++ b/src/MyTested.AspNetCore.Mvc.Abstractions/Internal/TestFramework.cs @@ -8,7 +8,7 @@ public static class TestFramework { public const string TestFrameworkName = "MyTested.AspNetCore.Mvc"; public const string ReleaseDate = "2019-07-01"; - public const string VersionPrefix = "2.1"; + public const string VersionPrefix = "2.2"; internal static void EnsureCorrectVersion(DependencyContext dependencyContext) { diff --git a/src/MyTested.AspNetCore.Mvc.Abstractions/MyTested.AspNetCore.Mvc.Abstractions.csproj b/src/MyTested.AspNetCore.Mvc.Abstractions/MyTested.AspNetCore.Mvc.Abstractions.csproj index e14bd9212..de548635c 100644 --- a/src/MyTested.AspNetCore.Mvc.Abstractions/MyTested.AspNetCore.Mvc.Abstractions.csproj +++ b/src/MyTested.AspNetCore.Mvc.Abstractions/MyTested.AspNetCore.Mvc.Abstractions.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC common abstractions and interfaces. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Abstractions - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,9 +35,9 @@ - - - + + + diff --git a/src/MyTested.AspNetCore.Mvc.Authentication/MyTested.AspNetCore.Mvc.Authentication.csproj b/src/MyTested.AspNetCore.Mvc.Authentication/MyTested.AspNetCore.Mvc.Authentication.csproj index df562eb7c..357ccdb01 100644 --- a/src/MyTested.AspNetCore.Mvc.Authentication/MyTested.AspNetCore.Mvc.Authentication.csproj +++ b/src/MyTested.AspNetCore.Mvc.Authentication/MyTested.AspNetCore.Mvc.Authentication.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC authentication components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Authentication - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Caching/MyTested.AspNetCore.Mvc.Caching.csproj b/src/MyTested.AspNetCore.Mvc.Caching/MyTested.AspNetCore.Mvc.Caching.csproj index d6f5707bc..897ec06a7 100644 --- a/src/MyTested.AspNetCore.Mvc.Caching/MyTested.AspNetCore.Mvc.Caching.csproj +++ b/src/MyTested.AspNetCore.Mvc.Caching/MyTested.AspNetCore.Mvc.Caching.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC caching components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Caching - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -33,7 +33,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Configuration/MyTested.AspNetCore.Mvc.Configuration.csproj b/src/MyTested.AspNetCore.Mvc.Configuration/MyTested.AspNetCore.Mvc.Configuration.csproj index 469fc8f1f..640d6491e 100644 --- a/src/MyTested.AspNetCore.Mvc.Configuration/MyTested.AspNetCore.Mvc.Configuration.csproj +++ b/src/MyTested.AspNetCore.Mvc.Configuration/MyTested.AspNetCore.Mvc.Configuration.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC configuration components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Configuration - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -32,7 +32,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/BaseTestBuilderWithStatusCodeResultExtensions.cs b/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/BaseTestBuilderWithStatusCodeResultExtensions.cs index 58c43d775..f98ee89d6 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/BaseTestBuilderWithStatusCodeResultExtensions.cs +++ b/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/BaseTestBuilderWithStatusCodeResultExtensions.cs @@ -13,14 +13,14 @@ public static class BaseTestBuilderWithStatusCodeResultExtensions { /// - /// Tests whether the status code action result + /// Tests whether the /// has the same status code as the provided one. /// /// /// Instance of type. /// /// Status code as integer. - /// The same status code action result test builder. + /// The same test builder. public static TStatusCodeResultTestBuilder WithStatusCode( this IBaseTestBuilderWithStatusCodeResult baseTestBuilderWithStatusCodeResult, int statusCode) @@ -29,14 +29,14 @@ public static TStatusCodeResultTestBuilder WithStatusCode - /// Tests whether the status code action result + /// Tests whether the /// has the same status code as the provided . /// /// /// Instance of type. /// /// enumeration. - /// The same status code action result test builder. + /// The same test builder. public static TStatusCodeResultTestBuilder WithStatusCode( this IBaseTestBuilderWithStatusCodeResult baseTestBuilderWithStatusCodeResult, SystemHttpStatusCode statusCode) diff --git a/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/MyTested.AspNetCore.Mvc.Controllers.ActionResults.csproj b/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/MyTested.AspNetCore.Mvc.Controllers.ActionResults.csproj index f7429d8d9..f6d032186 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/MyTested.AspNetCore.Mvc.Controllers.ActionResults.csproj +++ b/src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/MyTested.AspNetCore.Mvc.Controllers.ActionResults.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC controller action result components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Controllers.ActionResults - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Controllers.Attributes/MyTested.AspNetCore.Mvc.Controllers.Attributes.csproj b/src/MyTested.AspNetCore.Mvc.Controllers.Attributes/MyTested.AspNetCore.Mvc.Controllers.Attributes.csproj index 18d1aadc5..7cb1363e0 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers.Attributes/MyTested.AspNetCore.Mvc.Controllers.Attributes.csproj +++ b/src/MyTested.AspNetCore.Mvc.Controllers.Attributes/MyTested.AspNetCore.Mvc.Controllers.Attributes.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC controller attribute components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Controllers.Attributes - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.csproj b/src/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.csproj index 8d4feb909..b00e477a8 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.csproj +++ b/src/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC controller view action result components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Controllers.Views/MyTested.AspNetCore.Mvc.Controllers.Views.csproj b/src/MyTested.AspNetCore.Mvc.Controllers.Views/MyTested.AspNetCore.Mvc.Controllers.Views.csproj index 03eb5c45e..1d7175ccb 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers.Views/MyTested.AspNetCore.Mvc.Controllers.Views.csproj +++ b/src/MyTested.AspNetCore.Mvc.Controllers.Views/MyTested.AspNetCore.Mvc.Controllers.Views.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC controller view assertion methods. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Controllers.Views - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,7 +35,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/ActionResults/Unauthorized/UnauthorizedTestBuilder.cs b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/ActionResults/Unauthorized/UnauthorizedTestBuilder.cs new file mode 100644 index 000000000..29dbb7dd2 --- /dev/null +++ b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/ActionResults/Unauthorized/UnauthorizedTestBuilder.cs @@ -0,0 +1,89 @@ +namespace MyTested.AspNetCore.Mvc.Builders.ActionResults.Unauthorized +{ + using System; + using Builders.Base; + using Contracts.ActionResults.Unauthorized; + using Contracts.And; + using Exceptions; + using Internal; + using Internal.Contracts.ActionResults; + using Internal.TestContexts; + using Microsoft.AspNetCore.Mvc; + + /// + /// Used for testing unauthorized result. + /// + /// + /// Type of unauthorized result - or . + /// + public class UnauthorizedTestBuilder + : BaseTestBuilderWithResponseModel, + IAndUnauthorizedTestBuilder, + IBaseTestBuilderWithOutputResultInternal + where TUnauthorizedResult : ActionResult + { + /// + /// Initializes a new instance of the class. + /// + /// containing data about the currently executed assertion chain. + public UnauthorizedTestBuilder(ControllerTestContext testContext) + : base(testContext) + { + } + + /// + /// Gets the unauthorized result test builder. + /// + /// Test builder of . + public IAndUnauthorizedTestBuilder ResultTestBuilder => this; + + /// + public IAndTestBuilder Passing(Action assertions) + { + this.ValidateUnauthorizedObjectResult(); + return this.Passing(assertions); + } + + /// + public IAndTestBuilder Passing(Func predicate) + { + this.ValidateUnauthorizedObjectResult(); + return this.Passing(predicate); + } + + /// + public IUnauthorizedTestBuilder AndAlso() => this; + + public override void ValidateNoModel() => this.WithNoModel(); + + /// + /// Throws new for the provided property name, expected value and actual value. + /// + /// Property name on which the testing failed. + /// Expected value of the tested property. + /// Actual value of the tested property. + public override void ThrowNewFailedValidationException(string propertyName, string expectedValue, string actualValue) + => throw new UnauthorizedResultAssertionException(string.Format( + ExceptionMessages.ActionResultFormat, + this.TestContext.ExceptionMessagePrefix, + "unauthorized", + propertyName, + expectedValue, + actualValue)); + + private void ValidateUnauthorizedObjectResult() + { + var actualResultType = this.ActionResult.GetType(); + var expectedResultType = typeof(UnauthorizedObjectResult); + + if (actualResultType != expectedResultType) + { + throw new UnauthorizedResultAssertionException(string.Format( + "{0} unauthorized result to be {1}, but it was {2}.", + this.TestContext.ExceptionMessagePrefix, + expectedResultType, + actualResultType)); + } + } + } +} \ No newline at end of file diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Actions/ShouldReturn/ShouldReturnUnauthorized.cs b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Actions/ShouldReturn/ShouldReturnUnauthorized.cs index a66ab7a07..8dbd9bc24 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Actions/ShouldReturn/ShouldReturnUnauthorized.cs +++ b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Actions/ShouldReturn/ShouldReturnUnauthorized.cs @@ -1,15 +1,35 @@ namespace MyTested.AspNetCore.Mvc.Builders.Actions.ShouldReturn { + using System; + using ActionResults.Unauthorized; + using Contracts.ActionResults.Unauthorized; using Contracts.And; using Microsoft.AspNetCore.Mvc; /// - /// Class containing methods for testing . + /// Class containing methods for testing + /// or . /// public partial class ShouldReturnTestBuilder { /// - public IAndTestBuilder Unauthorized() - => this.ValidateActionResult(); + public IAndTestBuilder Unauthorized() => this.Unauthorized(null); + + /// + public IAndTestBuilder Unauthorized(Action unauthorizedTestBuilder) + { + if (this.ActionResult is UnauthorizedObjectResult) + { + return this.ValidateUnauthorizedResult(unauthorizedTestBuilder); + } + + return this.ValidateUnauthorizedResult(unauthorizedTestBuilder); + } + + private IAndTestBuilder ValidateUnauthorizedResult(Action unauthorizedTestBuilder) + where TUnauthorizedResult : ActionResult + => this.ValidateActionResult( + unauthorizedTestBuilder, + new UnauthorizedTestBuilder(this.TestContext)); } } diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Base/IBaseTestBuilderWithStatusCodeResult.cs b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Base/IBaseTestBuilderWithStatusCodeResult.cs index 6f754d5c1..a92e3947e 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Base/IBaseTestBuilderWithStatusCodeResult.cs +++ b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Base/IBaseTestBuilderWithStatusCodeResult.cs @@ -3,7 +3,7 @@ using Contracts.Base; /// - /// Base interface for all test builders with status code action result. + /// Base interface for all test builders with . /// /// Type of status code result test builder to use as a return type for common methods. public interface IBaseTestBuilderWithStatusCodeResult diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Unauthorized/IAndUnauthorizedTestBuilder.cs b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Unauthorized/IAndUnauthorizedTestBuilder.cs new file mode 100644 index 000000000..7bf944b75 --- /dev/null +++ b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Unauthorized/IAndUnauthorizedTestBuilder.cs @@ -0,0 +1,18 @@ +namespace MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Unauthorized +{ + /// + /// Used for adding AndAlso() method to + /// the + /// or tests. + /// + public interface IAndUnauthorizedTestBuilder : IUnauthorizedTestBuilder + { + /// + /// AndAlso method for better readability when + /// chaining + /// or tests. + /// + /// The same . + IUnauthorizedTestBuilder AndAlso(); + } +} \ No newline at end of file diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Unauthorized/IUnauthorizedTestBuilder.cs b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Unauthorized/IUnauthorizedTestBuilder.cs new file mode 100644 index 000000000..c586d46ea --- /dev/null +++ b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/ActionResults/Unauthorized/IUnauthorizedTestBuilder.cs @@ -0,0 +1,17 @@ +namespace MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Unauthorized +{ + using Base; + using Contracts.Base; + using Microsoft.AspNetCore.Mvc; + + /// + /// Used for testing + /// or result. + /// + public interface IUnauthorizedTestBuilder + : IBaseTestBuilderWithResponseModel, + IBaseTestBuilderWithOutputResult, + IBaseTestBuilderWithActionResult + { + } +} \ No newline at end of file diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/Actions/IShouldReturnTestBuilder.cs b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/Actions/IShouldReturnTestBuilder.cs index fedc03a5c..672cd15b0 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/Actions/IShouldReturnTestBuilder.cs +++ b/src/MyTested.AspNetCore.Mvc.Controllers/Builders/Contracts/Actions/IShouldReturnTestBuilder.cs @@ -14,6 +14,7 @@ using ActionResults.Ok; using ActionResults.Redirect; using ActionResults.StatusCode; + using ActionResults.Unauthorized; using ActionResults.UnprocessableEntity; using And; using Invocations; @@ -189,11 +190,20 @@ public interface IShouldReturnTestBuilder IAndTestBuilder NotFound(Action notFoundTestBuilder); /// - /// Tests whether the action result is . + /// Tests whether the action result is + /// or . /// /// Test builder of type. IAndTestBuilder Unauthorized(); + /// + /// Tests whether the action result is + /// or . + /// + /// Builder for testing the unauthorized result. + /// Test builder of type. + IAndTestBuilder Unauthorized(Action unauthorizedTestBuilder); + /// /// Tests whether the action result is . /// diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/Exceptions/UnauthorizedResultAssertionException.cs b/src/MyTested.AspNetCore.Mvc.Controllers/Exceptions/UnauthorizedResultAssertionException.cs index 63b57711a..95473591c 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers/Exceptions/UnauthorizedResultAssertionException.cs +++ b/src/MyTested.AspNetCore.Mvc.Controllers/Exceptions/UnauthorizedResultAssertionException.cs @@ -3,7 +3,8 @@ using System; /// - /// for invalid . + /// for invalid + /// or . /// public class UnauthorizedResultAssertionException : Exception { diff --git a/src/MyTested.AspNetCore.Mvc.Controllers/MyTested.AspNetCore.Mvc.Controllers.csproj b/src/MyTested.AspNetCore.Mvc.Controllers/MyTested.AspNetCore.Mvc.Controllers.csproj index f2a1080f1..f1cdbf4d6 100644 --- a/src/MyTested.AspNetCore.Mvc.Controllers/MyTested.AspNetCore.Mvc.Controllers.csproj +++ b/src/MyTested.AspNetCore.Mvc.Controllers/MyTested.AspNetCore.Mvc.Controllers.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC controller components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Controllers - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Core/MyTested.AspNetCore.Mvc.Core.csproj b/src/MyTested.AspNetCore.Mvc.Core/MyTested.AspNetCore.Mvc.Core.csproj index 3da3fe934..76c6ce610 100644 --- a/src/MyTested.AspNetCore.Mvc.Core/MyTested.AspNetCore.Mvc.Core.csproj +++ b/src/MyTested.AspNetCore.Mvc.Core/MyTested.AspNetCore.Mvc.Core.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC core components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Core - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.DataAnnotations/MyTested.AspNetCore.Mvc.DataAnnotations.csproj b/src/MyTested.AspNetCore.Mvc.DataAnnotations/MyTested.AspNetCore.Mvc.DataAnnotations.csproj index cbd851443..2a65e3b30 100644 --- a/src/MyTested.AspNetCore.Mvc.DataAnnotations/MyTested.AspNetCore.Mvc.DataAnnotations.csproj +++ b/src/MyTested.AspNetCore.Mvc.DataAnnotations/MyTested.AspNetCore.Mvc.DataAnnotations.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC data annotations components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.DataAnnotations - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -34,7 +34,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.DependencyInjection/MyTested.AspNetCore.Mvc.DependencyInjection.csproj b/src/MyTested.AspNetCore.Mvc.DependencyInjection/MyTested.AspNetCore.Mvc.DependencyInjection.csproj index b97826bd6..d1e491cec 100644 --- a/src/MyTested.AspNetCore.Mvc.DependencyInjection/MyTested.AspNetCore.Mvc.DependencyInjection.csproj +++ b/src/MyTested.AspNetCore.Mvc.DependencyInjection/MyTested.AspNetCore.Mvc.DependencyInjection.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC dependency injection components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.DependencyInjection - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/MyTested.AspNetCore.Mvc.EntityFrameworkCore.csproj b/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/MyTested.AspNetCore.Mvc.EntityFrameworkCore.csproj index d781efccf..56768b3eb 100644 --- a/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/MyTested.AspNetCore.Mvc.EntityFrameworkCore.csproj +++ b/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/MyTested.AspNetCore.Mvc.EntityFrameworkCore.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC Entity Framework Core components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.EntityFrameworkCore - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -33,8 +33,8 @@ - - + + diff --git a/src/MyTested.AspNetCore.Mvc.Helpers/MyTested.AspNetCore.Mvc.Helpers.csproj b/src/MyTested.AspNetCore.Mvc.Helpers/MyTested.AspNetCore.Mvc.Helpers.csproj index 9fa029745..a27b59ac7 100644 --- a/src/MyTested.AspNetCore.Mvc.Helpers/MyTested.AspNetCore.Mvc.Helpers.csproj +++ b/src/MyTested.AspNetCore.Mvc.Helpers/MyTested.AspNetCore.Mvc.Helpers.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC helper components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Helpers - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Helpers/ShouldReturnTestBuilderUnauthorizedResultExtensions.cs b/src/MyTested.AspNetCore.Mvc.Helpers/ShouldReturnTestBuilderUnauthorizedResultExtensions.cs new file mode 100644 index 000000000..6535d7334 --- /dev/null +++ b/src/MyTested.AspNetCore.Mvc.Helpers/ShouldReturnTestBuilderUnauthorizedResultExtensions.cs @@ -0,0 +1,28 @@ +namespace MyTested.AspNetCore.Mvc +{ + using Builders.Contracts.Actions; + using Builders.Contracts.And; + + /// + /// Contains and + /// extension methods for . + /// + public static class ShouldReturnTestBuilderUnauthorizedResultExtensions + { + /// + /// Tests whether the action result is + /// with the same deeply equal model as the provided one. + /// + /// Type of the action result. + /// Expected model type. + /// Instance of type. + /// Expected deeply equal model object. + /// Test builder of type. + public static IAndTestBuilder Unauthorized( + this IShouldReturnTestBuilder shouldReturnTestBuilder, + TModel model) + => shouldReturnTestBuilder + .Unauthorized(result => result + .WithModel(model)); + } +} \ No newline at end of file diff --git a/src/MyTested.AspNetCore.Mvc.Http/MyTested.AspNetCore.Mvc.Http.csproj b/src/MyTested.AspNetCore.Mvc.Http/MyTested.AspNetCore.Mvc.Http.csproj index 53e24598a..9ef95971f 100644 --- a/src/MyTested.AspNetCore.Mvc.Http/MyTested.AspNetCore.Mvc.Http.csproj +++ b/src/MyTested.AspNetCore.Mvc.Http/MyTested.AspNetCore.Mvc.Http.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC HTTP components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Http - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,7 +35,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Licensing/MyTested.AspNetCore.Mvc.Licensing.csproj b/src/MyTested.AspNetCore.Mvc.Licensing/MyTested.AspNetCore.Mvc.Licensing.csproj index 742cd7ddd..5ff89201f 100644 --- a/src/MyTested.AspNetCore.Mvc.Licensing/MyTested.AspNetCore.Mvc.Licensing.csproj +++ b/src/MyTested.AspNetCore.Mvc.Licensing/MyTested.AspNetCore.Mvc.Licensing.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC licensing components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Licensing - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Lite/MyTested.AspNetCore.Mvc.Lite.csproj b/src/MyTested.AspNetCore.Mvc.Lite/MyTested.AspNetCore.Mvc.Lite.csproj index 357390e7d..359692aa3 100644 --- a/src/MyTested.AspNetCore.Mvc.Lite/MyTested.AspNetCore.Mvc.Lite.csproj +++ b/src/MyTested.AspNetCore.Mvc.Lite/MyTested.AspNetCore.Mvc.Lite.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC is a powerful testing library providing easy fluent interface to test the ASP.NET Core MVC framework. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Lite - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,7 +35,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.ModelState/MyTested.AspNetCore.Mvc.ModelState.csproj b/src/MyTested.AspNetCore.Mvc.ModelState/MyTested.AspNetCore.Mvc.ModelState.csproj index d9afd6040..40ae947d3 100644 --- a/src/MyTested.AspNetCore.Mvc.ModelState/MyTested.AspNetCore.Mvc.ModelState.csproj +++ b/src/MyTested.AspNetCore.Mvc.ModelState/MyTested.AspNetCore.Mvc.ModelState.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC model state components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.ModelState - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -33,7 +33,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Models/MyTested.AspNetCore.Mvc.Models.csproj b/src/MyTested.AspNetCore.Mvc.Models/MyTested.AspNetCore.Mvc.Models.csproj index a340d726b..0d293ac90 100644 --- a/src/MyTested.AspNetCore.Mvc.Models/MyTested.AspNetCore.Mvc.Models.csproj +++ b/src/MyTested.AspNetCore.Mvc.Models/MyTested.AspNetCore.Mvc.Models.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC model components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Models - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Options/MyTested.AspNetCore.Mvc.Options.csproj b/src/MyTested.AspNetCore.Mvc.Options/MyTested.AspNetCore.Mvc.Options.csproj index 83cba1a87..c99946ed4 100644 --- a/src/MyTested.AspNetCore.Mvc.Options/MyTested.AspNetCore.Mvc.Options.csproj +++ b/src/MyTested.AspNetCore.Mvc.Options/MyTested.AspNetCore.Mvc.Options.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC configuration options components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Options - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -33,7 +33,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Routing/MyTested.AspNetCore.Mvc.Routing.csproj b/src/MyTested.AspNetCore.Mvc.Routing/MyTested.AspNetCore.Mvc.Routing.csproj index 4ac9375db..be9d6c5ae 100644 --- a/src/MyTested.AspNetCore.Mvc.Routing/MyTested.AspNetCore.Mvc.Routing.csproj +++ b/src/MyTested.AspNetCore.Mvc.Routing/MyTested.AspNetCore.Mvc.Routing.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC routing components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Routing - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.Routing/ServiceCollectionRoutingExtensions.cs b/src/MyTested.AspNetCore.Mvc.Routing/ServiceCollectionRoutingExtensions.cs index 39f724fbd..113d06872 100644 --- a/src/MyTested.AspNetCore.Mvc.Routing/ServiceCollectionRoutingExtensions.cs +++ b/src/MyTested.AspNetCore.Mvc.Routing/ServiceCollectionRoutingExtensions.cs @@ -55,6 +55,9 @@ public static IServiceCollection AddRoutingTesting(this IServiceCollection servi routingServiceCollection.AddModelBindingActionInvoker(); } + // Disable end-point routing until it is fully supported by the test framework. + routingServiceCollection.Configure(options => options.EnableEndpointRouting = false); + routingServices.ServiceCollection = routingServiceCollection; return serviceCollection; diff --git a/src/MyTested.AspNetCore.Mvc.Session/MyTested.AspNetCore.Mvc.Session.csproj b/src/MyTested.AspNetCore.Mvc.Session/MyTested.AspNetCore.Mvc.Session.csproj index 8ed61edba..aee42eed5 100644 --- a/src/MyTested.AspNetCore.Mvc.Session/MyTested.AspNetCore.Mvc.Session.csproj +++ b/src/MyTested.AspNetCore.Mvc.Session/MyTested.AspNetCore.Mvc.Session.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC session middleware components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Session - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -33,7 +33,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.TempData/MyTested.AspNetCore.Mvc.TempData.csproj b/src/MyTested.AspNetCore.Mvc.TempData/MyTested.AspNetCore.Mvc.TempData.csproj index 58aa739e2..f079c5de7 100644 --- a/src/MyTested.AspNetCore.Mvc.TempData/MyTested.AspNetCore.Mvc.TempData.csproj +++ b/src/MyTested.AspNetCore.Mvc.TempData/MyTested.AspNetCore.Mvc.TempData.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC temporary data components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.TempData - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,7 +35,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.Universe/MyTested.AspNetCore.Mvc.Universe.csproj b/src/MyTested.AspNetCore.Mvc.Universe/MyTested.AspNetCore.Mvc.Universe.csproj index 2e4948ad8..0debba43a 100644 --- a/src/MyTested.AspNetCore.Mvc.Universe/MyTested.AspNetCore.Mvc.Universe.csproj +++ b/src/MyTested.AspNetCore.Mvc.Universe/MyTested.AspNetCore.Mvc.Universe.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC is a powerful testing library providing easy fluent interface to test the ASP.NET Core MVC framework. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.Universe - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.ViewComponents.Attributes/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.csproj b/src/MyTested.AspNetCore.Mvc.ViewComponents.Attributes/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.csproj index b68466dc4..a2a84205f 100644 --- a/src/MyTested.AspNetCore.Mvc.ViewComponents.Attributes/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.csproj +++ b/src/MyTested.AspNetCore.Mvc.ViewComponents.Attributes/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC view component attribute assertion methods. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.ViewComponents.Attributes - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.ViewComponents.Results/MyTested.AspNetCore.Mvc.ViewComponents.Results.csproj b/src/MyTested.AspNetCore.Mvc.ViewComponents.Results/MyTested.AspNetCore.Mvc.ViewComponents.Results.csproj index 155f60ac1..237e9a9cb 100644 --- a/src/MyTested.AspNetCore.Mvc.ViewComponents.Results/MyTested.AspNetCore.Mvc.ViewComponents.Results.csproj +++ b/src/MyTested.AspNetCore.Mvc.ViewComponents.Results/MyTested.AspNetCore.Mvc.ViewComponents.Results.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC view component result assertion methods. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.ViewComponents.Results - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 diff --git a/src/MyTested.AspNetCore.Mvc.ViewComponents/MyTested.AspNetCore.Mvc.ViewComponents.csproj b/src/MyTested.AspNetCore.Mvc.ViewComponents/MyTested.AspNetCore.Mvc.ViewComponents.csproj index 40361b0d2..c87a1cd36 100644 --- a/src/MyTested.AspNetCore.Mvc.ViewComponents/MyTested.AspNetCore.Mvc.ViewComponents.csproj +++ b/src/MyTested.AspNetCore.Mvc.ViewComponents/MyTested.AspNetCore.Mvc.ViewComponents.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC view components assertion methods. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.ViewComponents - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,7 +35,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.ViewData/MyTested.AspNetCore.Mvc.ViewData.csproj b/src/MyTested.AspNetCore.Mvc.ViewData/MyTested.AspNetCore.Mvc.ViewData.csproj index de0bcfd53..a8d09d212 100644 --- a/src/MyTested.AspNetCore.Mvc.ViewData/MyTested.AspNetCore.Mvc.ViewData.csproj +++ b/src/MyTested.AspNetCore.Mvc.ViewData/MyTested.AspNetCore.Mvc.ViewData.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC view data components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.ViewData - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,7 +35,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc.ViewFeatures/MyTested.AspNetCore.Mvc.ViewFeatures.csproj b/src/MyTested.AspNetCore.Mvc.ViewFeatures/MyTested.AspNetCore.Mvc.ViewFeatures.csproj index 8621250de..882be3a78 100644 --- a/src/MyTested.AspNetCore.Mvc.ViewFeatures/MyTested.AspNetCore.Mvc.ViewFeatures.csproj +++ b/src/MyTested.AspNetCore.Mvc.ViewFeatures/MyTested.AspNetCore.Mvc.ViewFeatures.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC view features components. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc.ViewFeatures - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -38,7 +38,7 @@ - + diff --git a/src/MyTested.AspNetCore.Mvc/MyTested.AspNetCore.Mvc.csproj b/src/MyTested.AspNetCore.Mvc/MyTested.AspNetCore.Mvc.csproj index 6556a7064..b6e7b9fa0 100644 --- a/src/MyTested.AspNetCore.Mvc/MyTested.AspNetCore.Mvc.csproj +++ b/src/MyTested.AspNetCore.Mvc/MyTested.AspNetCore.Mvc.csproj @@ -4,7 +4,7 @@ My Tested ASP.NET Core MVC is a powerful testing library providing easy fluent interface to test the ASP.NET Core MVC framework. 2015-2019 Ivaylo Kenov MyTested.AspNetCore.Mvc - 2.1.0 + 2.2.0 Ivaylo Kenov netstandard2.0 $(NoWarn);CS1591 @@ -35,7 +35,7 @@ - + diff --git a/test/MyTested.AspNetCore.Mvc.Abstractions.Test/MyTested.AspNetCore.Mvc.Abstractions.Test.csproj b/test/MyTested.AspNetCore.Mvc.Abstractions.Test/MyTested.AspNetCore.Mvc.Abstractions.Test.csproj index aba5a3a06..80f05522d 100644 --- a/test/MyTested.AspNetCore.Mvc.Abstractions.Test/MyTested.AspNetCore.Mvc.Abstractions.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Abstractions.Test/MyTested.AspNetCore.Mvc.Abstractions.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Authentication.Test/MyTested.AspNetCore.Mvc.Authentication.Test.csproj b/test/MyTested.AspNetCore.Mvc.Authentication.Test/MyTested.AspNetCore.Mvc.Authentication.Test.csproj index 0d99d9921..9aeea1be0 100644 --- a/test/MyTested.AspNetCore.Mvc.Authentication.Test/MyTested.AspNetCore.Mvc.Authentication.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Authentication.Test/MyTested.AspNetCore.Mvc.Authentication.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -28,8 +28,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Caching.Test/MyTested.AspNetCore.Mvc.Caching.Test.csproj b/test/MyTested.AspNetCore.Mvc.Caching.Test/MyTested.AspNetCore.Mvc.Caching.Test.csproj index 021b544e2..e19fab155 100644 --- a/test/MyTested.AspNetCore.Mvc.Caching.Test/MyTested.AspNetCore.Mvc.Caching.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Caching.Test/MyTested.AspNetCore.Mvc.Caching.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -29,8 +29,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Configuration.Test/MyTested.AspNetCore.Mvc.Configuration.Test.csproj b/test/MyTested.AspNetCore.Mvc.Configuration.Test/MyTested.AspNetCore.Mvc.Configuration.Test.csproj index ecc1c905e..22a185dbd 100644 --- a/test/MyTested.AspNetCore.Mvc.Configuration.Test/MyTested.AspNetCore.Mvc.Configuration.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Configuration.Test/MyTested.AspNetCore.Mvc.Configuration.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -15,9 +15,12 @@ - + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignInTests/SignInTestBuilderTests.cs b/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignInTests/SignInTestBuilderTests.cs index eebb4d05f..3734eb6f5 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignInTests/SignInTestBuilderTests.cs +++ b/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignInTests/SignInTestBuilderTests.cs @@ -79,7 +79,6 @@ public void AndAlsoShouldWorkCorrectly() .WithAuthenticationScheme(AuthenticationScheme.Basic)); } - [Fact] public void PassingShouldCorrectlyRunItsAssertionFunction() { diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignOutTests/SignOutTestBuilderTests.cs b/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignOutTests/SignOutTestBuilderTests.cs index 3e4b02b6f..f4438f244 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignOutTests/SignOutTestBuilderTests.cs +++ b/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/ActionResultsTests/SignOutTests/SignOutTestBuilderTests.cs @@ -138,7 +138,6 @@ public void AndAlsoShouldWorkCorrectly() .ContainingAuthenticationScheme(AuthenticationScheme.NTLM)); } - [Fact] public void PassingShouldCorrectlyRunItsAssertionFunction() { diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test.csproj b/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test.csproj index e78860d99..fb93e374d 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -27,8 +27,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test.csproj b/test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test.csproj index ba3c4f9cd..a6c379584 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test/MyTested.AspNetCore.Mvc.Controllers.Attributes.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -15,9 +15,12 @@ - + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Test/MyTested.AspNetCore.Mvc.Controllers.Test.csproj b/test/MyTested.AspNetCore.Mvc.Controllers.Test/MyTested.AspNetCore.Mvc.Controllers.Test.csproj index ee28aecb3..1ee09725b 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Test/MyTested.AspNetCore.Mvc.Controllers.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Test/MyTested.AspNetCore.Mvc.Controllers.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonSerializerTestBuilderTests.cs b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonSerializerTestBuilderTests.cs index 8550d72ee..1250b9a9e 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonSerializerTestBuilderTests.cs +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonSerializerTestBuilderTests.cs @@ -1,5 +1,6 @@ namespace MyTested.AspNetCore.Mvc.Test.BuildersTests.ActionResultsTests.JsonTests { + using System; using System.Collections; using System.Collections.Generic; using System.Globalization; @@ -42,6 +43,46 @@ public void WithCheckAdditionalContentShouldThrowExceptionWithIncorrectValue() "When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have enabled checking for additional content, but in fact it was disabled."); } + [Fact] + public void WithCheckAdditionalContentShouldThrowExceptionForDisabledAdditionalChecks() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.CheckAdditionalContent = true; + + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithAdditionalContentChecking(false))); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have disabled checking for additional content, but in fact it was enabled."); + } + + [Fact] + public void WithCheckAdditionalContentShouldThrowExceptionForEnabledAdditionalChecks() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.CheckAdditionalContent = false; + + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithAdditionalContentChecking(true))); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have enabled checking for additional content, but in fact it was disabled."); + } + [Fact] public void WithCultureShouldNotThrowExceptionWithCorrectValue() { @@ -149,6 +190,21 @@ public void WithContractResolverShouldNotThrowExceptionWithCorrectValue() s.WithContractResolver(jsonSettings.ContractResolver))); } + [Fact] + public void WithoutContractResolverShouldNotThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.ContractResolver = null; + + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithContractResolver(null))); + } + [Fact] public void WithContractResolverShouldThrowExceptionWithIncorrectValue() { @@ -166,6 +222,95 @@ public void WithContractResolverShouldThrowExceptionWithIncorrectValue() "When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have the same contract resolver as the provided one, but in fact it was different."); } + [Fact] + public void WithContractResolverOfTypeShouldNotThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithContractResolverOfType(typeof(CamelCasePropertyNamesContractResolver)))); + } + + [Fact] + public void WithContractResolverOfTypeShouldThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithContractResolverOfType(typeof(IContractResolver)))); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have IContractResolver, but in fact found CamelCasePropertyNamesContractResolver."); + } + + [Fact] + public void WithoutContractResolverOfTypeShouldThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.ContractResolver = null; + + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithContractResolverOfType(typeof(DefaultContractResolver)))); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have DefaultContractResolver, but in fact found null."); + } + + [Fact] + public void WithDefaultContractResolverOfTypeShouldThrowExceptionWithIncorrectValue() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.ContractResolver = new DefaultContractResolver(); + + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithContractResolverOfType(typeof(CamelCasePropertyNamesContractResolver)))); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have CamelCasePropertyNamesContractResolver, but in fact found DefaultContractResolver."); + } + + [Fact] + public void WithCamelCaseContractResolverShouldThrowExceptionWithIncorrectValue() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonAction()) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithContractResolverOfType(typeof(CamelCasePropertyNamesContractResolver)))); + }, + "When calling JsonAction action in MvcController expected JSON result serializer settings to have CamelCasePropertyNamesContractResolver, but in fact found DefaultContractResolver."); + } + [Fact] public void WithContractResolverShouldValidateOnlyTheProperty() { @@ -704,6 +849,22 @@ public void WithEqualityComparerOfTypeWithTypeShouldNotThrowExceptionWithCorrect s.WithEqualityComparerOfType(typeof(CustomEqualityComparer)))); } + [Fact] + public void WithEqualityComparerOfTypeShouldThrowException() + { + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(new JsonSerializerSettings())) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithEqualityComparerOfType(typeof(IEqualityComparer)))); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have equality comparer of IEqualityComparer type, but in fact found null."); + } + [Fact] public void WithFloatFormatHandlingShouldNotThrowExceptionWithCorrectValue() { @@ -857,6 +1018,18 @@ public void WithReferenceResolverOfTypeShouldThrowExceptionWithIncorrectValue() "When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have reference resolver of IReferenceResolver type, but in fact found CustomJsonReferenceResolver."); } + [Fact] + public void WithReferenceResolverOfTypeShouldNotThrowException() + { + MyController + .Instance() + .Calling(c => c.JsonWithSettingsAction()) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithReferenceResolverOfType(typeof(CustomJsonReferenceResolver)))); + } + [Fact] public void WithReferenceResolverOfTypeWithTypeShouldNotThrowExceptionWithCorrectValue() { @@ -872,6 +1045,21 @@ public void WithReferenceResolverOfTypeWithTypeShouldNotThrowExceptionWithCorrec s.WithReferenceResolverOfType(typeof(CustomJsonReferenceResolver)))); } + [Fact] + public void WithReferenceResolverOfTypeShouldNotThrowExceptionWithNull() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.ReferenceResolverProvider = () => null; + + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithReferenceResolverOfType(null))); + } + [Fact] public void WithStringEscapeHandlingShouldNotThrowExceptionWithCorrectValue() { @@ -1387,6 +1575,18 @@ public void WithTraceWriterShouldThrowExceptionWithIncorrectValue() "When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have the same trace writer as the provided one, but in fact it was different."); } + [Fact] + public void WithTraceWriterOfTypeShouldNotThrowException() + { + MyController + .Instance() + .Calling(c => c.JsonWithSettingsAction()) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithTraceWriterOfType(typeof(CustomJsonTraceWriter)))); + } + [Fact] public void WithTraceWriterOfTypeShouldNotThrowExceptionWithCorrectValue() { @@ -1402,6 +1602,37 @@ public void WithTraceWriterOfTypeShouldNotThrowExceptionWithCorrectValue() s.WithTraceWriterOfType())); } + [Fact] + public void WithTraceWriterOfTypeShouldNotThrowExceptionWithDefaultWriter() + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(new JsonSerializerSettings())) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithTraceWriterOfType(null))); + } + + [Fact] + public void WithTraceWriterOfTypeShouldThrowExceptionWithDifferentTypes() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.TraceWriter = new DiagnosticsTraceWriter(); + + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithTraceWriterOfType(typeof(CustomJsonTraceWriter)))); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have trace writer of CustomJsonTraceWriter type, but in fact found DiagnosticsTraceWriter."); + } + [Fact] public void WithTraceWriterOfTypeShouldThrowExceptionWithIncorrectValue() { @@ -1434,6 +1665,175 @@ public void WithTraceWriterOfTypeWithTypeShouldNotThrowExceptionWithCorrectValue s.WithTraceWriterOfType(typeof(CustomJsonTraceWriter)))); } + [Fact] + public void WithSerializationBinderShouldNotThrowExceptionWithCorrectValue() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + var defaultSerializationBinder = new DefaultSerializationBinder(); + jsonSerializerSettings.SerializationBinder = defaultSerializationBinder; + + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinder(defaultSerializationBinder))); + } + + [Fact] + public void WithoutSerializationBinderShouldNotThrowExceptionWithCorrectValue() + { + MyController + .Instance() + .Calling(c => c.JsonAction()) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinder(null))); + } + + [Fact] + public void WithSerializationBinderShouldThrowExceptionWithIncorrectValue() + { + var defaultSerializationBinder = new DefaultSerializationBinder(); + + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSettingsAction()) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinder(defaultSerializationBinder))); + }, + "When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have the same serialization binder as the provided one, but in fact it was different."); + } + + [Fact] + public void WithoutSerializationBinderOfTypeShouldNotThrowExceptionWithCorrectValue() + { + MyController + .Instance() + .Calling(c => c.JsonAction()) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinderOfType(null))); + } + + [Fact] + public void WithSerializationBinderOfTypeShouldNotThrowExceptionWithCorrectValue() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + var defaultSerializationBinder = new DefaultSerializationBinder(); + jsonSerializerSettings.SerializationBinder = defaultSerializationBinder; + + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinderOfType(typeof(DefaultSerializationBinder)))); + } + + [Fact] + public void WithPreviouslySetSerializationBinderShouldThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + var defaultSerializationBinder = new DefaultSerializationBinder(); + jsonSerializerSettings.SerializationBinder = defaultSerializationBinder; + + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinderOfType(typeof(DefaultSerializationBinder)))); + }, + "Cannot get SerializationBinder because an ISerializationBinder was previously set."); + } + + [Fact] + public void WithSerializationBinderOfTypeShouldThrowExceptionWithIncorrectValue() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSettingsAction()) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinderOfType(typeof(DefaultSerializationBinder)))); + }, + "When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have serialization binder of DefaultSerializationBinder type, but in fact found null."); + } + + [Fact] + public void WithSerializationBinderOfTypeShouldNotThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.SerializationBinder = new DefaultSerializationBinder(); + + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinderOfType())); + } + + [Fact] + public void WithSerializationBinderOfTypeShouldThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.SerializationBinder = null; + + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinderOfType())); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have serialization binder of DefaultSerializationBinder type, but in fact found null."); + } + + [Fact] + public void WithPreviouslySetSerializationBinderOfTypeShouldThrowException() + { + var jsonSerializerSettings = TestObjectFactory.GetJsonSerializerSettings(); + jsonSerializerSettings.SerializationBinder = new DefaultSerializationBinder(); + + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSerializerSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(s => + s.WithSerializationBinderOfType())); + }, + "Cannot get SerializationBinder because an ISerializationBinder was previously set."); + } + [Fact] public void AndAlsoShouldNotThrowExceptionWithCorrectValues() { diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonTestBuilderTests.cs b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonTestBuilderTests.cs index 43f3d9b76..7a33f1bce 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonTestBuilderTests.cs +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/JsonTests/JsonTestBuilderTests.cs @@ -19,6 +19,53 @@ public void WithDefaultJsonSettingsShouldNotThrowExceptionWithDefaultJsonSetting .WithDefaultJsonSerializerSettings()); } + [Fact] + public void WithDefaultJsonSettingsShouldNotThrowExceptionAndPassAssertions() + { + MyController + .Instance() + .Calling(c => c.JsonAction()) + .ShouldReturn() + .Json(result => result + .WithDefaultJsonSerializerSettings() + .AndAlso() + .Passing(json => + { + Assert.Null(json.SerializerSettings); + })); + } + + [Fact] + public void WithDefaultJsonSettingsShouldThrowExceptionWithNull() + { + Assert.Throws(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(null)) + .ShouldReturn() + .Json(json => json + .WithDefaultJsonSerializerSettings()); + }); + } + + [Fact] + public void WithDefaultJsonSettingsShouldThrowExceptionWithBuildInSerializationSettings() + { + var jsonSettings = new JsonSerializerSettings(); + + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSettings)) + .ShouldReturn() + .Json(json => json + .WithDefaultJsonSerializerSettings()); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have DefaultContractResolver, but in fact found null."); + } + [Fact] public void WithJsonSerializerSettingsShouldNotThrowExceptionWithSameJsonSettings() { @@ -29,7 +76,96 @@ public void WithJsonSerializerSettingsShouldNotThrowExceptionWithSameJsonSetting .Json(json => json .WithJsonSerializerSettings(TestObjectFactory.GetJsonSerializerSettings())); } - + + [Fact] + public void WithJsonSerializerSettingsShouldNotThrowExceptionWithValidSettings() + { + var jsonSettings = TestObjectFactory.GetJsonSerializerSettings(); + + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(jsonSettings)); + } + + [Fact] + public void WithJsonSerializerSettingsShouldNotThrowExceptionWithBuiltInSettings() + { + var jsonSettings = new JsonSerializerSettings(); + + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(jsonSettings)); + } + + [Fact] + public void WithJsonSerializerSettingsShouldNotThrowExceptionWithActionSettings() + { + var jsonSettings = new JsonSerializerSettings + { + CheckAdditionalContent = true, + NullValueHandling = NullValueHandling.Ignore + }; + + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(settings => + { + settings.WithAdditionalContentChecking(true); + settings.WithNullValueHandling(NullValueHandling.Ignore); + })); + } + + [Fact] + public void WithJsonSerializerSettingsShouldThrowExceptionWithActionSettings() + { + var jsonSettings = new JsonSerializerSettings + { + CheckAdditionalContent = true, + NullValueHandling = NullValueHandling.Ignore + }; + + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(jsonSettings)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(settings => + { + settings.WithAdditionalContentChecking(false); + settings.WithNullValueHandling(NullValueHandling.Ignore); + })); + }, + "When calling JsonWithSpecificSettingsAction action in MvcController expected JSON result serializer settings to have disabled checking for additional content, but in fact it was enabled."); + } + + [Fact] + public void WithJsonSerializerSettingsShouldThrowExceptionWithNull() + { + var jsonSettings = TestObjectFactory.GetJsonSerializerSettings(); + + Assert.Throws(() => + { + MyController + .Instance() + .Calling(c => c.JsonWithSpecificSettingsAction(null)) + .ShouldReturn() + .Json(json => json + .WithJsonSerializerSettings(jsonSettings)); + }); + } + [Fact] public void WithJsonSerializerSettingsShouldThrowExceptionWithDifferentJsonSettings() { diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/ViewTests/ViewTestBuilderTests.cs b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/ViewTests/ViewTestBuilderTests.cs index 8e08074e2..a065e695b 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/ViewTests/ViewTestBuilderTests.cs +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionResultsTests/ViewTests/ViewTestBuilderTests.cs @@ -22,6 +22,51 @@ public void WithViewEngineShouldNotThrowExceptionWithValidViewEngine() .WithViewEngine(viewEngine)); } + [Fact] + public void WithViewEngineShouldNotThrowExceptionWithBuiltInView() + { + MyController + .Instance() + .Calling(c => c.View()) + .ShouldReturn() + .View(view => view + .WithViewEngine(null)); + } + + [Fact] + public void WithViewEngineShouldNotThrowExceptionWithValidViewEngineAndPassAssertions() + { + var viewEngine = TestObjectFactory.GetViewEngine(); + + MyController + .Instance() + .Calling(c => c.ViewWithViewEngine(viewEngine)) + .ShouldReturn() + .View(result => result + .WithViewEngine(viewEngine) + .AndAlso() + .Passing(view => + { + Assert.NotNull(view.ViewEngine); + Assert.IsAssignableFrom(view.ViewEngine); + Assert.True(typeof(CustomViewEngine) == view.ViewEngine.GetType()); + })); + } + + [Fact] + public void WithViewEngineShouldNotThrowExceptionWithBuiltInViewAndPassAssertions() + { + MyController + .Instance() + .Calling(c => c.View()) + .ShouldReturn() + .View(result => result + .Passing(view => + { + Assert.Null(view.ViewEngine); + })); + } + [Fact] public void WithViewEngineShouldNotThrowExceptionWithNullViewEngine() { @@ -50,6 +95,25 @@ public void WithViewEngineShouldThrowExceptionWithInvalidViewEngine() "When calling ViewWithViewEngine action in MvcController expected view result engine to be the same as the provided one, but instead received different result."); } + [Fact] + public void WithViewEngineShouldThrowExceptionWithIncorrectValue() + { + var viewEngine = TestObjectFactory.GetViewEngine(); + + Test.AssertException( + () => + { + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.ViewWithViewEngine(viewEngine)) + .ShouldReturn() + .View(view => view + .WithViewEngine(null)); + }, + "When calling ViewWithViewEngine action in MvcController expected view result engine to be the same as the provided one, but instead received different result."); + } + [Fact] public void WithViewEngineOfTypeShouldNotThrowExceptionWithValidViewEngine() { @@ -61,6 +125,47 @@ public void WithViewEngineOfTypeShouldNotThrowExceptionWithValidViewEngine() .WithViewEngineOfType()); } + [Fact] + public void WithViewEngineOfTypeShouldNotThrowExceptionWithValidViewEngineAndCustomViewResult() + { + MyController + .Instance() + .Calling(c => c.CustomViewResult()) + .ShouldReturn() + .View(view => view + .WithViewEngineOfType()); + } + + [Fact] + public void WithViewEngineOfTypeShouldThrowExceptionWithInvalidTypeAndCustomViewResult() + { + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.CustomViewResult()) + .ShouldReturn() + .View(view => view + .WithViewEngineOfType()); + }, + "When calling CustomViewResult action in MvcController expected view result engine to be of IViewEngine type, but instead received CustomViewEngine."); + } + + [Fact] + public void WithViewEngineOfTypeShouldThrowExceptionWithDifferentTypes() + { + Test.AssertException(() => + { + MyController + .Instance() + .Calling(c => c.CustomViewResult()) + .ShouldReturn() + .View(view => view + .WithViewEngineOfType()); + }, + "When calling CustomViewResult action in MvcController expected view result engine to be of CompositeViewEngine type, but instead received CustomViewEngine."); + } + [Fact] public void WithViewEngineOfTypeShouldThrowExceptionWithInvalidViewEngine() { @@ -107,6 +212,41 @@ public void WithViewEngineShouldNotThrowExceptionWithValidViewEngineForPartials( .WithViewEngine(viewEngine)); } + [Fact] + public void WithViewEngineShouldNotThrowExceptionWithValidViewEngineForPartialsAndPassAssertions() + { + var viewEngine = TestObjectFactory.GetViewEngine(); + + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.PartialViewWithViewEngine(viewEngine)) + .ShouldReturn() + .PartialView(result => result + .WithViewEngine(viewEngine) + .AndAlso() + .Passing(partialView => + { + Assert.NotNull(partialView.ViewEngine); + Assert.IsAssignableFrom(partialView.ViewEngine); + Assert.True(typeof(CustomViewEngine) == partialView.ViewEngine.GetType()); + })); + } + + [Fact] + public void WithViewEngineShouldNotThrowExceptionWithValidViewEngineForBuiltInPartials() + { + var viewEngine = TestObjectFactory.GetViewEngine(); + + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.PartialView()) + .ShouldReturn() + .PartialView(partialView => partialView + .WithViewEngine(null)); + } + [Fact] public void WithViewEngineShouldNotThrowExceptionWithNullViewEngineForPartials() { @@ -119,6 +259,25 @@ public void WithViewEngineShouldNotThrowExceptionWithNullViewEngineForPartials() .WithViewEngine(null)); } + [Fact] + public void WithViewEngineShouldThrowExceptionWithCustomViewEngineForPartials() + { + var viewEngine = TestObjectFactory.GetViewEngine(); + + Test.AssertException( + () => + { + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.DefaultPartialView()) + .ShouldReturn() + .PartialView(partialView => partialView + .WithViewEngine(viewEngine)); + }, + "When calling DefaultPartialView action in MvcController expected partial view result engine to be the same as the provided one, but instead received different result."); + } + [Fact] public void WithViewEngineShouldThrowExceptionWithInvalidViewEngineForPartials() { @@ -136,6 +295,25 @@ public void WithViewEngineShouldThrowExceptionWithInvalidViewEngineForPartials() "When calling PartialViewWithViewEngine action in MvcController expected partial view result engine to be the same as the provided one, but instead received different result."); } + [Fact] + public void WithViewEngineForPartialsShouldThrowExceptionWithIncorrectValue() + { + var viewEngine = TestObjectFactory.GetViewEngine(); + + Test.AssertException( + () => + { + MyController + .Instance() + .WithoutValidation() + .Calling(c => c.PartialViewWithViewEngine(viewEngine)) + .ShouldReturn() + .PartialView(partialView => partialView + .WithViewEngine(null)); + }, + "When calling PartialViewWithViewEngine action in MvcController expected partial view result engine to be the same as the provided one, but instead received different result."); + } + [Fact] public void WithViewEngineOfTypeShouldNotThrowExceptionWithValidViewEngineForPartials() { diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewComponentTests.cs b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewComponentTests.cs index 614e1122b..bc9ec7aea 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewComponentTests.cs +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewComponentTests.cs @@ -20,6 +20,57 @@ public void ShouldReturnViewComponentShouldNotThrowExceptionWithCorrectViewCompo .WithName("TestComponent")); } + [Fact] + public void ShouldReturnViewComponentShouldNotThrowExceptionWithViewComponentName() + { + MyController + .Instance() + .Calling(c => c.ViewComponent("MyComponent")) + .ShouldReturn() + .ViewComponent(viewComponent => viewComponent + .WithName("MyComponent")); + } + + [Fact] + public void ShouldReturnViewComponentShouldNotThrowExceptionWithEmptyViewComponentName() + { + MyController + .Instance() + .Calling(c => c.ViewComponent(string.Empty)) + .ShouldReturn() + .ViewComponent(viewComponent => viewComponent + .WithName(string.Empty)); + } + + [Fact] + public void ShouldReturnViewComponentShouldNotThrowExceptionWithViewComponentNameAndPassAssertions() + { + MyController + .Instance() + .Calling(c => c.ViewComponent("MyComponent")) + .ShouldReturn() + .ViewComponent(result => result + .WithName("MyComponent") + .AndAlso() + .Passing(viewComponent => + { + Assert.NotNull(viewComponent); + Assert.NotEmpty(viewComponent.ViewComponentName); + Assert.True(typeof(ViewComponentResult) == viewComponent.GetType()); + })); + } + + [Fact] + public void ShouldReturnViewComponentShouldNotThrowExceptionWithNull() + { + MyController + .Instance() + .Calling(c => c.CustomViewComponentResult()) + .ShouldReturn() + .ViewComponent(viewComponent => viewComponent + .WithName(null)); + } + [Fact] public void ShouldReturnViewComponentShouldThrowExceptionWithIncorrectViewComponentWithName() { @@ -52,6 +103,22 @@ public void ShouldReturnViewComponentShouldThrowExceptionWithIncorrectViewCompon "When calling ViewComponentResultByName action in MvcController expected view component result to be 'Incorrect', but instead received 'TestComponent'."); } + [Fact] + public void ShouldReturnViewComponentShouldThrowExceptionWithDifferentCaseViewComponentName() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.ViewComponent("Incorrect")) + .ShouldReturn() + .ViewComponent(viewComponent => viewComponent + .WithName("incorrect")); + }, + "When calling ViewComponent action in MvcController expected view component result to be 'incorrect', but instead received 'Incorrect'."); + } + [Fact] public void ShouldReturnViewComponentShouldNotThrowExceptionWithCorrectViewComponentType() { @@ -62,7 +129,18 @@ public void ShouldReturnViewComponentShouldNotThrowExceptionWithCorrectViewCompo .ViewComponent(viewComponent => viewComponent .OfType(typeof(CustomViewComponent))); } - + + [Fact] + public void ShouldReturnViewComponentShouldNotThrowExceptionWithNullComponentType() + { + MyController + .Instance() + .Calling(c => c.CustomViewComponentResult()) + .ShouldReturn() + .ViewComponent(viewComponent => viewComponent + .OfType(null)); + } + [Fact] public void ShouldReturnViewComponentShouldNotThrowExceptionWithCorrectViewComponentTypeAsGeneric() { @@ -105,5 +183,37 @@ public void ShouldReturnViewComponentShouldThrowExceptionWithIncorrectViewCompon }, "When calling ViewComponentResultByType action in MvcController expected view component result to be 'ViewComponent', but instead received 'CustomViewComponent'."); } + + [Fact] + public void ShouldReturnViewComponentShouldThrowExceptionWithNullComponentType() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.ViewComponentResultByType()) + .ShouldReturn() + .ViewComponent(viewComponent => viewComponent + .OfType(null)); + }, + "When calling ViewComponentResultByType action in MvcController expected view component result to be 'null', but instead received 'CustomViewComponent'."); + } + + [Fact] + public void ShouldReturnViewComponentShouldThrowExceptionWithIncorrectViewComponentTypeAsGeneric() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.ViewComponent("Test")) + .ShouldReturn() + .ViewComponent(viewComponent => viewComponent + .OfType()); + }, + "When calling ViewComponent action in MvcController expected view component result to be 'CustomViewComponent', but instead received 'null'."); + } } } diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewTests.cs b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewTests.cs index fb1316a07..42c9f2b21 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewTests.cs +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/BuildersTests/ActionsTests/ShouldReturnTests/ShouldReturnViewTests.cs @@ -1,8 +1,11 @@ namespace MyTested.AspNetCore.Mvc.Test.BuildersTests.ActionsTests.ShouldReturnTests { + using System.Collections.Generic; using Exceptions; + using Microsoft.AspNetCore.Mvc; using Setups; using Setups.Controllers; + using Setups.Models; using Xunit; public class ShouldReturnViewTests @@ -17,7 +20,47 @@ public void ShouldReturnViewWithNameShouldNotThrowExceptionWithCorrectName() .View(view => view .WithName("Index")); } - + + [Fact] + public void ShouldReturnViewWithNameShouldNotThrowExceptionAndPassAssertions() + { + MyController + .Instance() + .Calling(c => c.IndexView()) + .ShouldReturn() + .View(result => result + .Passing(view => + { + Assert.False(string.IsNullOrEmpty(view.ViewName)); + Assert.Equal("Index", view.ViewName); + Assert.True(typeof(ViewResult) == view.GetType()); + })); + } + + [Fact] + public void ShouldReturnViewShouldNotThrowExceptionWithCorrectViewName() + { + MyController + .Instance() + .Calling(c => c.ViewResultByName()) + .ShouldReturn() + .View(view => view + .WithName("TestView")); + } + + [Fact] + public void ShouldReturnViewWithNameShouldNotThrowExceptionWithCorrectViewResultType() + { + MyController + .Instance() + .Calling(c => c.IndexView()) + .ShouldReturn() + .View(result => result + .WithName("Index") + .AndAlso() + .Passing(view => view.GetType() == typeof(ViewResult))); + } + [Fact] public void ShouldReturnViewShouldThrowExceptionIfActionResultIsViewResultWithDifferentName() { @@ -33,7 +76,55 @@ public void ShouldReturnViewShouldThrowExceptionIfActionResultIsViewResultWithDi }, "When calling IndexView action in MvcController expected view result to be 'Incorrect', but instead received 'Index'."); } - + + [Fact] + public void ShouldReturnViewShouldThrowExceptionWithEmptyString() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.IndexView()) + .ShouldReturn() + .View(view => view + .WithName(string.Empty)); + }, + "When calling IndexView action in MvcController expected view result to be '', but instead received 'Index'."); + } + + [Fact] + public void ShouldReturnViewShouldThrowExceptionWithNullViewName() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.IndexView()) + .ShouldReturn() + .View(view => view + .WithName(null)); + }, + "When calling IndexView action in MvcController expected view result to be the default one, but instead received 'Index'."); + } + + [Fact] + public void ShouldReturnViewShouldThrowExceptionWithIncorrectViewResultAndName() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.BadRequestAction()) + .ShouldReturn() + .View(view => view + .WithName("TestView")); + }, + "When calling BadRequestAction action in MvcController expected result to be ViewResult, but instead received BadRequestResult."); + } + [Fact] public void ShouldReturnPartialViewWithNameShouldNotThrowExceptionWithCorrectName() { @@ -44,7 +135,23 @@ public void ShouldReturnPartialViewWithNameShouldNotThrowExceptionWithCorrectNam .PartialView(view => view .WithName("_IndexPartial")); } - + + [Fact] + public void ShouldReturnPartialViewWithNameShouldNotThrowExceptionAndPassAssertions() + { + MyController + .Instance() + .Calling(c => c.IndexPartialView()) + .ShouldReturn() + .PartialView(result => result + .Passing(partialView => + { + Assert.False(string.IsNullOrEmpty(partialView.ViewName)); + Assert.Equal("_IndexPartial", partialView.ViewName); + Assert.True(typeof(PartialViewResult) == partialView.GetType()); + })); + } + [Fact] public void ShouldReturnPartialViewShouldThrowExceptionIfActionResultIsViewResultWithDifferentName() { @@ -60,5 +167,127 @@ public void ShouldReturnPartialViewShouldThrowExceptionIfActionResultIsViewResul }, "When calling IndexPartialView action in MvcController expected partial view result to be 'Incorrect', but instead received '_IndexPartial'."); } + + [Fact] + public void ShouldReturnPartialViewShouldThrowExceptionWithNullViewName() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.IndexPartialView()) + .ShouldReturn() + .PartialView(view => view + .WithName(null)); + }, + "When calling IndexPartialView action in MvcController expected partial view result to be the default one, but instead received '_IndexPartial'."); + } + + [Fact] + public void ShouldReturnParrtialViewShouldThrowExceptionWithIncorrectViewResult() + { + Test.AssertException( + () => + { + MyController + .Instance() + .Calling(c => c.BadRequestAction()) + .ShouldReturn() + .PartialView(view => view + .WithName("_IndexPartial")); + }, + "When calling BadRequestAction action in MvcController expected result to be PartialViewResult, but instead received BadRequestResult."); + } + + [Fact] + public void ShouldReturnViewWithDefaultNameShouldNotThrowException() + { + MyController + .Instance() + .Calling(c => c.DefaultView()) + .ShouldReturn() + .View(view => view + .WithDefaultName()); + } + + [Fact] + public void ShouldReturnViewWithDefaultNameShouldNotThrowExceptionAndPassAssertions() + { + MyController + .Instance() + .Calling(c => c.DefaultView()) + .ShouldReturn() + .View(result => result + .Passing(view => + { + Assert.True(string.IsNullOrEmpty(view.ViewName)); + Assert.True(view.GetType() == typeof(ViewResult)); + })); + } + + [Fact] + public void ShouldReturnViewWithDefaultNameAndViewModelShouldNotThrowException() + { + MyController + .Instance() + .Calling(c => c.DefaultViewWithModel()) + .ShouldReturn() + .View(view => view + .WithDefaultName() + .AndAlso() + .WithModelOfType>()); + } + + [Fact] + public void ShouldReturnViewWithDefaultNameAndCustomViewResultTypeShouldNotThrowExceptionWithCorrectType() + { + MyController + .Instance() + .Calling(c => c.CustomViewResult()) + .ShouldReturn() + .View(result => result + .WithDefaultName() + .Passing(view => view.GetType() == typeof(ViewResult))); + } + + [Fact] + public void ShouldReturnPartialViewWithDefaultNameShouldNotThrowException() + { + MyController + .Instance() + .Calling(c => c.DefaultPartialView()) + .ShouldReturn() + .PartialView(view => view + .WithDefaultName()); + } + + [Fact] + public void ShouldReturnPartialViewWithDefaultNameShouldNotThrowExceptionAndPassAssertions() + { + MyController + .Instance() + .Calling(c => c.DefaultPartialView()) + .ShouldReturn() + .PartialView(result => result + .Passing(partialView => + { + Assert.True(string.IsNullOrEmpty(partialView.ViewName)); + Assert.True(partialView.GetType() == typeof(PartialViewResult)); + })); + } + + [Fact] + public void ShouldReturnPartialViewWithDefaultNameAndViewModelShouldNotThrowException() + { + MyController + .Instance() + .Calling(c => c.DefaultPartialViewWithModel()) + .ShouldReturn() + .PartialView(view => view + .WithDefaultName() + .AndAlso() + .WithModelOfType>()); + } } } diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test.csproj b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test.csproj index 953f1fb8a..4f6b0861f 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test/MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -27,8 +27,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Controllers.Views.Test/MyTested.AspNetCore.Mvc.Controllers.Views.Test.csproj b/test/MyTested.AspNetCore.Mvc.Controllers.Views.Test/MyTested.AspNetCore.Mvc.Controllers.Views.Test.csproj index a85c03758..de8bc5016 100644 --- a/test/MyTested.AspNetCore.Mvc.Controllers.Views.Test/MyTested.AspNetCore.Mvc.Controllers.Views.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Controllers.Views.Test/MyTested.AspNetCore.Mvc.Controllers.Views.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk true @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.DataAnnotations.Test/MyTested.AspNetCore.Mvc.DataAnnotations.Test.csproj b/test/MyTested.AspNetCore.Mvc.DataAnnotations.Test/MyTested.AspNetCore.Mvc.DataAnnotations.Test.csproj index cf03a5ed4..d86846157 100644 --- a/test/MyTested.AspNetCore.Mvc.DataAnnotations.Test/MyTested.AspNetCore.Mvc.DataAnnotations.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.DataAnnotations.Test/MyTested.AspNetCore.Mvc.DataAnnotations.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.DependencyInjection.Test/MyTested.AspNetCore.Mvc.DependencyInjection.Test.csproj b/test/MyTested.AspNetCore.Mvc.DependencyInjection.Test/MyTested.AspNetCore.Mvc.DependencyInjection.Test.csproj index 12de0a14a..783b5dd3d 100644 --- a/test/MyTested.AspNetCore.Mvc.DependencyInjection.Test/MyTested.AspNetCore.Mvc.DependencyInjection.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.DependencyInjection.Test/MyTested.AspNetCore.Mvc.DependencyInjection.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -29,8 +29,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test.csproj b/test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test.csproj index 869a2f394..bb1b1979f 100644 --- a/test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -29,10 +29,13 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + diff --git a/test/MyTested.AspNetCore.Mvc.Helpers.Test/MyTested.AspNetCore.Mvc.Helpers.Test.csproj b/test/MyTested.AspNetCore.Mvc.Helpers.Test/MyTested.AspNetCore.Mvc.Helpers.Test.csproj index ba9b2cc20..9d853c2a6 100644 --- a/test/MyTested.AspNetCore.Mvc.Helpers.Test/MyTested.AspNetCore.Mvc.Helpers.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Helpers.Test/MyTested.AspNetCore.Mvc.Helpers.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Http.Test/MyTested.AspNetCore.Mvc.Http.Test.csproj b/test/MyTested.AspNetCore.Mvc.Http.Test/MyTested.AspNetCore.Mvc.Http.Test.csproj index 778c1409f..b3b1400c4 100644 --- a/test/MyTested.AspNetCore.Mvc.Http.Test/MyTested.AspNetCore.Mvc.Http.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Http.Test/MyTested.AspNetCore.Mvc.Http.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -28,8 +28,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Licensing.Test/MyTested.AspNetCore.Mvc.Licensing.Test.csproj b/test/MyTested.AspNetCore.Mvc.Licensing.Test/MyTested.AspNetCore.Mvc.Licensing.Test.csproj index 1731b508c..9dd553425 100644 --- a/test/MyTested.AspNetCore.Mvc.Licensing.Test/MyTested.AspNetCore.Mvc.Licensing.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Licensing.Test/MyTested.AspNetCore.Mvc.Licensing.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true true MyTested.AspNetCore.Mvc.Licensing.Test @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Lite.Test/MyTested.AspNetCore.Mvc.Lite.Test.csproj b/test/MyTested.AspNetCore.Mvc.Lite.Test/MyTested.AspNetCore.Mvc.Lite.Test.csproj index 97c20f833..b6ca14440 100644 --- a/test/MyTested.AspNetCore.Mvc.Lite.Test/MyTested.AspNetCore.Mvc.Lite.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Lite.Test/MyTested.AspNetCore.Mvc.Lite.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.ModelState.Test/MyTested.AspNetCore.Mvc.ModelState.Test.csproj b/test/MyTested.AspNetCore.Mvc.ModelState.Test/MyTested.AspNetCore.Mvc.ModelState.Test.csproj index dd0d2872c..8a78d791b 100644 --- a/test/MyTested.AspNetCore.Mvc.ModelState.Test/MyTested.AspNetCore.Mvc.ModelState.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.ModelState.Test/MyTested.AspNetCore.Mvc.ModelState.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -29,8 +29,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Models.Test/MyTested.AspNetCore.Mvc.Models.Test.csproj b/test/MyTested.AspNetCore.Mvc.Models.Test/MyTested.AspNetCore.Mvc.Models.Test.csproj index 31110f7fb..9b88ae117 100644 --- a/test/MyTested.AspNetCore.Mvc.Models.Test/MyTested.AspNetCore.Mvc.Models.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Models.Test/MyTested.AspNetCore.Mvc.Models.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -27,8 +27,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Options.Test/MyTested.AspNetCore.Mvc.Options.Test.csproj b/test/MyTested.AspNetCore.Mvc.Options.Test/MyTested.AspNetCore.Mvc.Options.Test.csproj index 021e33d63..bc5c605cc 100644 --- a/test/MyTested.AspNetCore.Mvc.Options.Test/MyTested.AspNetCore.Mvc.Options.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Options.Test/MyTested.AspNetCore.Mvc.Options.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -28,10 +28,13 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + diff --git a/test/MyTested.AspNetCore.Mvc.Routing.Test/MyTested.AspNetCore.Mvc.Routing.Test.csproj b/test/MyTested.AspNetCore.Mvc.Routing.Test/MyTested.AspNetCore.Mvc.Routing.Test.csproj index bf0ea044c..816a5350b 100644 --- a/test/MyTested.AspNetCore.Mvc.Routing.Test/MyTested.AspNetCore.Mvc.Routing.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Routing.Test/MyTested.AspNetCore.Mvc.Routing.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -29,8 +29,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Session.Test/MyTested.AspNetCore.Mvc.Session.Test.csproj b/test/MyTested.AspNetCore.Mvc.Session.Test/MyTested.AspNetCore.Mvc.Session.Test.csproj index efed81009..069875950 100644 --- a/test/MyTested.AspNetCore.Mvc.Session.Test/MyTested.AspNetCore.Mvc.Session.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Session.Test/MyTested.AspNetCore.Mvc.Session.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -29,8 +29,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ActionsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ActionsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs index b2b2b0812..651b93a14 100644 --- a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ActionsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs +++ b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ActionsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs @@ -1,9 +1,9 @@ namespace MyTested.AspNetCore.Mvc.Test.BuildersTests.ActionsTests.ShouldHaveTests { + using System.Collections.Generic; using Exceptions; using Setups; using Setups.Controllers; - using System.Collections.Generic; using Xunit; public class ShouldHaveTempDataTests diff --git a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ControllersTests/ControllerBuilderTests.cs b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ControllersTests/ControllerBuilderTests.cs index 490e5a605..2841fa722 100644 --- a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ControllersTests/ControllerBuilderTests.cs +++ b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ControllersTests/ControllerBuilderTests.cs @@ -13,7 +13,8 @@ public void WithValidTempDataValueShouldPopulateTempDataCorrectly() { MyController .Instance() - .WithTempData(tempData => tempData.WithEntry("test", "value")) + .WithTempData(tempData => tempData + .WithEntry("test", "value")) .Calling(c => c.TempDataAction()) .ShouldReturn() .Ok(); @@ -24,7 +25,8 @@ public void WithInvalidTempDataValueShouldReturnBadRequest() { MyController .Instance() - .WithTempData(tempData => tempData.WithEntry("invalid", "value")) + .WithTempData(tempData => tempData + .WithEntry("invalid", "value")) .Calling(c => c.TempDataAction()) .ShouldReturn() .BadRequest(); @@ -52,7 +54,8 @@ public void WithValidTempDataValueShouldPopulateTempDataCorrectlyForPocoControll MyController .Instance() - .WithTempData(tempData => tempData.WithEntry("test", "value")) + .WithTempData(tempData => tempData + .WithEntry("test", "value")) .Calling(c => c.TempDataAction()) .ShouldReturn() .Ok(); @@ -65,7 +68,8 @@ public void WithInvalidTempDataValueShouldReturnBadRequestForPocoController() { MyApplication .StartsFrom() - .WithServices(services => services.TryAddSingleton()); + .WithServices(services => services + .TryAddSingleton()); MyController .Instance() @@ -82,7 +86,8 @@ public void WithTempDataShouldPopulateTempDataForPocoController() { MyApplication .StartsFrom() - .WithServices(services => services.TryAddSingleton()); + .WithServices(services => services + .TryAddSingleton()); MyController .Instance() diff --git a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/InvocationsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/InvocationsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs index 118c27373..c4f3fa1be 100644 --- a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/InvocationsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs +++ b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/InvocationsTests/ShouldHaveTests/ShouldHaveTempDataTests.cs @@ -1,9 +1,9 @@ namespace MyTested.AspNetCore.Mvc.Test.BuildersTests.InvocationsTests.ShouldHaveTests { + using System.Collections.Generic; using Exceptions; using Setups; using Setups.ViewComponents; - using System.Collections.Generic; using Xunit; public class ShouldHaveTempDataTests diff --git a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ViewComponentsTests/ViewComponentBuilderTests.cs b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ViewComponentsTests/ViewComponentBuilderTests.cs index 0f6a90c44..501d9107d 100644 --- a/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ViewComponentsTests/ViewComponentBuilderTests.cs +++ b/test/MyTested.AspNetCore.Mvc.TempData.Test/BuildersTests/ViewComponentsTests/ViewComponentBuilderTests.cs @@ -13,7 +13,8 @@ public void WithValidTempDataValueShouldPopulateTempDataCorrectly() { MyViewComponent .Instance() - .WithTempData(tempData => tempData.WithEntry("test", "value")) + .WithTempData(tempData => tempData + .WithEntry("test", "value")) .InvokedWith(c => c.Invoke()) .ShouldReturn() .Content("value"); @@ -24,7 +25,8 @@ public void WithInvalidTempDataValueShouldReturnViewWithNoModel() { MyViewComponent .Instance() - .WithTempData(tempData => tempData.WithEntry("invalid", "value")) + .WithTempData(tempData => tempData + .WithEntry("invalid", "value")) .InvokedWith(c => c.Invoke()) .ShouldReturn() .View(); @@ -48,7 +50,8 @@ public void WithTempDataShouldPopulateTempDataForPocoController() { MyApplication .StartsFrom() - .WithServices(services => services.TryAddSingleton()); + .WithServices(services => services + .TryAddSingleton()); MyViewComponent .Instance() diff --git a/test/MyTested.AspNetCore.Mvc.TempData.Test/MyTested.AspNetCore.Mvc.TempData.Test.csproj b/test/MyTested.AspNetCore.Mvc.TempData.Test/MyTested.AspNetCore.Mvc.TempData.Test.csproj index a9599070f..9f1882a76 100644 --- a/test/MyTested.AspNetCore.Mvc.TempData.Test/MyTested.AspNetCore.Mvc.TempData.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.TempData.Test/MyTested.AspNetCore.Mvc.TempData.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -29,8 +29,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Test.Setups/Controllers/MvcController.cs b/test/MyTested.AspNetCore.Mvc.Test.Setups/Controllers/MvcController.cs index 02b1aae93..b9073fbea 100644 --- a/test/MyTested.AspNetCore.Mvc.Test.Setups/Controllers/MvcController.cs +++ b/test/MyTested.AspNetCore.Mvc.Test.Setups/Controllers/MvcController.cs @@ -4,8 +4,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; - using System.Security.Claims; using System.Threading.Tasks; + using Builders.Authentication; using Common; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; @@ -18,7 +18,6 @@ using Microsoft.Extensions.FileProviders; using Microsoft.Net.Http.Headers; using Models; - using MyTested.AspNetCore.Mvc.Builders.Authentication; using Newtonsoft.Json; using Services; @@ -85,6 +84,11 @@ public IActionResult IndexView() return this.View("Index", this.ResponseModel); } + public IActionResult ViewResultByName() + { + return this.View("TestView", new { id = 1, test = "text" }); + } + public IActionResult CustomViewResult() { return new ViewResult diff --git a/test/MyTested.AspNetCore.Mvc.Test.Setups/MyTested.AspNetCore.Mvc.Test.Setups.csproj b/test/MyTested.AspNetCore.Mvc.Test.Setups/MyTested.AspNetCore.Mvc.Test.Setups.csproj index 3ac482595..a58b4c71b 100644 --- a/test/MyTested.AspNetCore.Mvc.Test.Setups/MyTested.AspNetCore.Mvc.Test.Setups.csproj +++ b/test/MyTested.AspNetCore.Mvc.Test.Setups/MyTested.AspNetCore.Mvc.Test.Setups.csproj @@ -17,7 +17,7 @@ - + diff --git a/test/MyTested.AspNetCore.Mvc.Test/MyTested.AspNetCore.Mvc.Test.csproj b/test/MyTested.AspNetCore.Mvc.Test/MyTested.AspNetCore.Mvc.Test.csproj index 18adb06c2..76a7502f6 100644 --- a/test/MyTested.AspNetCore.Mvc.Test/MyTested.AspNetCore.Mvc.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Test/MyTested.AspNetCore.Mvc.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -25,8 +25,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.Universe.Test/MyTested.AspNetCore.Mvc.Universe.Test.csproj b/test/MyTested.AspNetCore.Mvc.Universe.Test/MyTested.AspNetCore.Mvc.Universe.Test.csproj index 4b5eecbe6..2a5825ce5 100644 --- a/test/MyTested.AspNetCore.Mvc.Universe.Test/MyTested.AspNetCore.Mvc.Universe.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.Universe.Test/MyTested.AspNetCore.Mvc.Universe.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test.csproj b/test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test.csproj index 4444f1bfb..d2ee637f8 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test/MyTested.AspNetCore.Mvc.ViewComponents.Attributes.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -15,9 +15,12 @@ - + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test.csproj b/test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test.csproj index 61a96098d..5ed4425a9 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test/MyTested.AspNetCore.Mvc.ViewComponents.Results.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -27,8 +27,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.ViewComponents.Test/MyTested.AspNetCore.Mvc.ViewComponents.Test.csproj b/test/MyTested.AspNetCore.Mvc.ViewComponents.Test/MyTested.AspNetCore.Mvc.ViewComponents.Test.csproj index 89f5b993a..71107ada3 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewComponents.Test/MyTested.AspNetCore.Mvc.ViewComponents.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.ViewComponents.Test/MyTested.AspNetCore.Mvc.ViewComponents.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -27,8 +27,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ComponentTestContextViewDataExtensionsTests.cs b/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ComponentTestContextViewDataExtensionsTests.cs index 18c2a3337..332b7a84e 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ComponentTestContextViewDataExtensionsTests.cs +++ b/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ComponentTestContextViewDataExtensionsTests.cs @@ -33,10 +33,8 @@ public void GetViewDataShouldHaveNoViewDataForPocoController() { MyApplication .StartsFrom() - .WithServices(services => - { - services.TryAddSingleton(); - }); + .WithServices(services => services + .TryAddSingleton()); MyController .Instance() diff --git a/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ViewDataPropertyHelperTests.cs b/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ViewDataPropertyHelperTests.cs index de78ffdaa..207c707a6 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ViewDataPropertyHelperTests.cs +++ b/test/MyTested.AspNetCore.Mvc.ViewData.Test/InternalTests/ViewDataPropertyHelperTests.cs @@ -1,5 +1,6 @@ namespace MyTested.AspNetCore.Mvc.Test.InternalTests { + using System; using Internal; using Internal.Services; using Microsoft.AspNetCore.Http; @@ -7,7 +8,6 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Setups; using Setups.Controllers; - using System; using Xunit; public class ViewDataPropertyHelperTests diff --git a/test/MyTested.AspNetCore.Mvc.ViewData.Test/MyTested.AspNetCore.Mvc.ViewData.Test.csproj b/test/MyTested.AspNetCore.Mvc.ViewData.Test/MyTested.AspNetCore.Mvc.ViewData.Test.csproj index 244ec9895..d892ff857 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewData.Test/MyTested.AspNetCore.Mvc.ViewData.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.ViewData.Test/MyTested.AspNetCore.Mvc.ViewData.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -28,8 +28,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/MyTested.AspNetCore.Mvc.ViewData.Test/PluginsTests/ViewDataTestPluginTests.cs b/test/MyTested.AspNetCore.Mvc.ViewData.Test/PluginsTests/ViewDataTestPluginTests.cs index d37678af3..945497b59 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewData.Test/PluginsTests/ViewDataTestPluginTests.cs +++ b/test/MyTested.AspNetCore.Mvc.ViewData.Test/PluginsTests/ViewDataTestPluginTests.cs @@ -33,10 +33,7 @@ public void ShouldInvokeMethodOfTypeVoidWithValidServiceCollection() testPlugin.DefaultServiceRegistrationDelegate(serviceCollection); - var methodReturnType = testPlugin.DefaultServiceRegistrationDelegate.Method.ReturnType.Name; - - Assert.True(methodReturnType == "Void"); - Assert.True(serviceCollection.Count == 126); + Assert.True(serviceCollection.Count == 145); } } } diff --git a/test/MyTested.AspNetCore.Mvc.ViewFeatures.Test/MyTested.AspNetCore.Mvc.ViewFeatures.Test.csproj b/test/MyTested.AspNetCore.Mvc.ViewFeatures.Test/MyTested.AspNetCore.Mvc.ViewFeatures.Test.csproj index 48b7bc01b..7a840afc8 100644 --- a/test/MyTested.AspNetCore.Mvc.ViewFeatures.Test/MyTested.AspNetCore.Mvc.ViewFeatures.Test.csproj +++ b/test/MyTested.AspNetCore.Mvc.ViewFeatures.Test/MyTested.AspNetCore.Mvc.ViewFeatures.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net461 + netcoreapp2.2;net461 true MyTested.AspNetCore.Mvc.Test ../../tools/Key.snk @@ -26,8 +26,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +