Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6ade11b
Added test action in mvc controller for testing view results by name.
Aug 11, 2019
4252131
Merge branch 'development' of https://github.com/ivaylokenov/MyTested…
Aug 11, 2019
779f88e
Added unit tests for BaseTestBuilderWithViewResultExtensions.
Aug 12, 2019
67a7d91
Added unit tests for ViewTestBuilder.
Aug 14, 2019
34a0ebf
Added one more unit test for BaseTestBuilderWithViewResultExtensions.
Aug 14, 2019
2488993
Added unit tests for ViewComponentTestBuilderExtensions.
Aug 14, 2019
d1d6213
Fixed exception error message.
Aug 15, 2019
dfdeab8
Added unit tests for JsonSerializerSettingsTestBuilder.
Aug 15, 2019
56b1ab6
Added unit tests for JsonTestBuilderExtensions.
Aug 17, 2019
573f207
Added more unit tests for JsonSerializerSettingsTestBuilder.
Aug 17, 2019
df41d67
Removed unnecessary indentations, replaced the short names in the lam…
Aug 18, 2019
b9b049a
Moved the System usings before all others.
Aug 18, 2019
95cebd7
Updated Travis CI to .NET Core version 2.2
ivaylokenov Aug 18, 2019
8122ac3
Merge pull request #319 - Added unit tests for covering MyTested.AspN…
ivaylokenov Aug 18, 2019
f959468
Updated all project files to use .NET Core 2.2
ivaylokenov Aug 18, 2019
fdc0177
Updated all projects to have version 2.2.0
ivaylokenov Aug 18, 2019
94a0acc
Updated the library to use ASP.NET Core 2.2
ivaylokenov Aug 18, 2019
2d89382
Updated README.md
ivaylokenov Aug 18, 2019
b89366e
Updated .travis.yml
ivaylokenov Aug 18, 2019
0b85bc6
Updated .travis.yml
ivaylokenov Aug 18, 2019
8ed694e
Updated .travis.yml
ivaylokenov Aug 18, 2019
e4291d6
Updated failing builds
ivaylokenov Aug 19, 2019
b334923
Deleted not needed files from the samples
ivaylokenov Aug 19, 2019
80a8422
Merge pull request #321 - Version 2.2.0
ivaylokenov Aug 19, 2019
faa767d
Merge branch 'master' into development
ivaylokenov Aug 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ branches:
- master
- development
- ^version-.*$
image: Visual Studio 2019 Preview
image: Visual Studio 2019
configuration: Release
clone_depth: 1
before_build:
Expand Down
61 changes: 36 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 7 additions & 0 deletions MyTested.AspNetCore.Mvc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

*Downloads:* [![NuGet Badge](https://buildstats.info/nuget/MyTested.AspNetCore.Mvc)](https://www.nuget.org/packages/MyTested.AspNetCore.Mvc/)

<img src="https://raw.githubusercontent.com/ivaylokenov/MyTested.AspNetCore.Mvc/version-2.1/tools/test-sample.gif" />
<img src="https://raw.githubusercontent.com/ivaylokenov/MyTested.AspNetCore.Mvc/version-2.2/tools/test-sample.gif" />

**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."
Expand Down Expand Up @@ -95,15 +95,15 @@ To add **MyTested.AspNetCore.Mvc** to your solution, you must follow these simpl
<Project Sdk="Microsoft.NET.Sdk.Web"> <!-- Changed project SDK -->

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" /> <!-- Reference to the web framework -->
<PackageReference Include="MyTested.AspNetCore.Mvc.Universe" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" /> <!-- Can be any testing framework -->
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="MyTested.AspNetCore.Mvc.Universe" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.1" /> <!-- Can be any testing framework -->
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -281,7 +281,6 @@ MyController<MyMvcController>
// and tests for added by the action temp data entry with а specific key,
// and tests for redirect result to a specific action.
MyController<MyMvcController>
.Instance()
.Calling(c => c.MyAction(new MyFormModel
{
Title = title,
Expand Down Expand Up @@ -409,7 +408,6 @@ MyController<MyMvcController>

// Tests for specific action attributes - HttpGet, AllowAnonymous, ValidateAntiForgeryToken, and ActionName.
MyController<MyMvcController>
.Instance()
.Calling(c => c.MyAction(With.Empty<int>())) // Provides no value for the action parameter.
.ShouldHave()
.ActionAttributes(attributes => attributes
Expand Down Expand Up @@ -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).

Expand All @@ -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).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand All @@ -15,10 +16,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
</ItemGroup>

</Project>

This file was deleted.

Loading