Commit Graph

14 Commits

Author SHA1 Message Date
Alexej Timonin d4beab5d09
CompositeValidationAttribute
- Add abstract CompositeValidationAttribute.
- Change DataAnnotationsMetadataProvider.CreateValidationMetadata to
populate ValidatorMetadata with validation attributes from CompositeValidationAttribute.
2018-07-20 15:31:14 -07:00
hishamco dee479fda7
Add partial helper to Razor Page \ PageModel
Fixes #7885
2018-07-09 11:01:15 -07:00
Pranav K 335500ab0e Use ModelMetadata from actual types for validation
Fixes https://github.com/aspnet/Mvc/issues/7952
2018-07-02 11:23:16 -07:00
Doug Bunting 53857d052f
Add BasicApi and BasicViews apps
- #7805
- make initial copy of apps from aspnet/Performance repo
  - add apps to solution
  - add Readme for the benchmark apps
- update BasicApi app to actually do authentication and authorization
  - bug in the ported app
- refactor `Main` methods and add `CreateWebHostBuilder(...)` methods
- change projects to understand `$(BenchmarksTargetFramework)`
  - use NuGet.org EF packages to avoid changing the Universe build graph
- use SQLite instead of LocalDb by default
  - remove unnecessary appsettings.json files and JSON configuration support
- add EF migrations
  - (greatly) reduce startup times compared to creating / deleting databases
- add MySql, PostgreSQL, and SqlServer support
  - load BasicApi data in a `DbContext.OnModelCreating(...)` override
    - no longer need seed.sql
  - generalize migrations to support multiple providers
  - use negative seeding indices to work around npgsql/Npgsql.EntityFrameworkCore.PostgreSQL#36
  - work around Pomelo lack of strong name (PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#603)
  - use BenchmarksOnly* properties for EF dependencies
    - see also aspnet/Universe#1224
- drop databases (if SQLite) or migrations (otherwise) in `IApplicationLifetime.ApplicationStopping` handlers
- add functional tests
  - drop SQLite database at end of test run
- add benchmarks automation
  - add anonymous BasicApi action i.e. require no authorization
  - add non-antiforgery BasicViews actions

Address PR comments
- remove `AntiforgeryTestHelper` workarounds
- use `[ApiController]`
- use `ActionResult<Pet>`
- remove unused classes

nits:
- take VS suggestions in added files
- optionally display create and delete SQL scripts for per-database migrations
- merge `InsertData(...)` calls for consistency with most supported EF providers
  - SQLite is the only one that requires separate `INSERT`s and EF does the splitting
2018-06-22 16:41:17 -07:00
Pranav K e1eaf6a6e0
Cleanup TestCommon 2018-05-18 10:45:57 -07:00
Doug Bunting ec2d5c7aa4
Run functional tests with a `TestLoggerFactory`
- #7744
2018-05-08 11:52:20 -07:00
Javier Calvarro Nelson e0b4c13895 [Fixes #7587] Default to Development environment in tests 2018-04-17 12:52:51 -07:00
Pranav K 133dd964ab Introduce ViewDataAttribute
Allow properties on controllers, Razor Page and Razor Page models annotatted with [ViewDataAttribute]
to populate ViewDataDictionary

Fixes https://github.com/aspnet/Mvc/issues/6525
2018-03-30 14:19:52 -07:00
Doug Bunting 5e245da326
Add compatibility switch controlling parameter metadata and top-level validation
- #7413 part 1 of 2
- made all `ModelMetadataProvider` and `ObjectModelValidator`-specific code conditional
  - fortunately, `MvcOptions` easy to get; affected code is primarily `internal` or pub-`Internal`
  - remove unnecessary `ModelMetadataProvider` use in `ApiBehaviorApplicationModelProvider`
- run integration and functional tests with `CompatibilityVersion.Version_2_1`
  - functional test change depends on @javiercn's recent #7541 fix
  - remove test code now redundantly turning compatibility switches on

nits:
- correct spelling errors in `CompatibilitySwitch`
- take VS suggestions, mostly in test code
- rename methods in `ControllerBinderDelegateProviderTest` to match current API
- slightly refactor in `ApiBehaviorApplicationModelProvider`
2018-03-26 12:29:04 -07:00
Javier Calvarro Nelson 908e7a863b Improvements to the MVC testing package
* Clean up unnecessary workarounds on the build project.
* Remove the need to specify the content root relative to the solution
  and use a solution based on an assembly level attribute on the test
  assembly created at build time.
* Remove non parameterless constructors.
* Add support for creating specialized factories from the base factory
  and keep track of "child" factories for disposal.
* Add support for creating clients that handle cookies and redirects
  automatically.
2018-03-19 12:19:45 -07:00
Javier Calvarro Nelson 85f3c841f1 Revert "Revert "Improvements to the testing package.""
This reverts commit 7b28334c41.
2017-09-19 21:45:05 -07:00
Ryan Brandenburg 7b28334c41 Revert "Improvements to the testing package."
This reverts commit 96bd2769d0.
2017-09-19 18:02:53 -07:00
Javier Calvarro Nelson 96bd2769d0 Improvements to the testing package.
* Detect a ConfigureDefaultBuilder static method on Program.cs of the test site
and use it to initialize the IWebHostBuilder instance that we configure for testing.
* Make use of the new service configuration extensibility points in Hosting to override
services for testing.
* Get rid of MvcWebApplicationBuilder and move MVC specific methods into extension methods.
2017-09-18 18:12:01 -07:00
Javier Calvarro Nelson e1c1682065 Testing infrastructure cleanup 2017-07-07 13:18:42 -07:00