From 19e6fb571936c4e263dc88aee215fd4b52b0dc9e Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Fri, 11 Dec 2015 12:35:13 -0800 Subject: [PATCH] MVC functional test cleanup part 1 - #3612 (subpart 1 of 2) - delete six sites and associated tests entirely - `ActionResultsWebSite` - `ActivatorWebSite` - `ControllerDiscoveryConventionsWebSite` - `LoggingWebSite` - `LowercaseUrlsWebSite` - `ModelBindingWebSite`, now covered in integration tests - remove now-unused `FilteredDefaultAssemblyProviderFixture`, `LoggingAssert` and `LoggingExtensions` - move six test web sites into `./samples` - `CustomRouteWebSite` -> `CustomRouteSample.Web` - `FormatFilterWebSite` -> `FormatFilterSample.Web` - `InlineConstraintsWebSite` -> `InlineConstraintSample.Web` (now singular) - `JsonPatchWebSite` -> `JsonPatchSample.Web` - `LocalizationWebSite` -> `LocalizationSample.Web` - `RazorEmbeddedViewsWebSite` -> `EmbeddedViewSample.Web` (no longer "Razor" and now singular) - do some cleanup: remove test dependencies, shorten sample controller names, use more attribute routing - correct "license" spelling in `ApplicationModelWebSite` --- Mvc.NoFun.sln | 90 + Mvc.sln | 264 +-- .../Controllers/Canada/ProductsController.cs | 4 +- .../Controllers/OrdersControlller.cs | 6 +- .../Controllers/Spain/ProductsController.cs | 4 +- .../Controllers/US/ProductsController.cs | 4 +- .../CustomRouteSample.Web.xproj | 4 +- .../CustomRouteSample.Web}/LocaleAttribute.cs | 2 +- .../CustomRouteSample.Web}/LocalizedRoute.cs | 2 +- .../CustomRouteSample.Web}/Startup.cs | 4 +- samples/CustomRouteSample.Web/project.json | 15 + .../CustomRouteSample.Web}/readme.md | 4 +- .../CustomRouteSample.Web/wwwroot/web.config | 9 + .../Controllers/AdminController.cs | 4 +- .../Controllers/HomeController.cs | 8 +- .../Restricted/Views/Admin}/Login.cshtml | 0 .../Views/Home/EchoActionUrl.cshtml | 0 .../EmbeddedResources/Views/Home/Index.cshtml | 13 + .../EmbeddedViewSample.Web.xproj | 4 +- .../EmbeddedViewSample.Web}/Startup.cs | 16 +- samples/EmbeddedViewSample.Web/project.json | 17 + .../EmbeddedViewSample.Web}/readme.md | 2 +- .../EmbeddedViewSample.Web/wwwroot/web.config | 9 + .../Controllers/FormatFilterController.cs | 7 +- .../Controllers/ProducesOverrideClass.cs | 9 +- .../CustomFormatter.cs | 17 +- .../FormatFilterSample.Web.xproj | 4 +- .../FormatFilterSample.Web/Models/Product.cs | 15 + .../FormatFilterSample.Web}/Startup.cs | 18 +- samples/FormatFilterSample.Web/project.json | 15 + samples/FormatFilterSample.Web/readme.md | 5 + .../FormatFilterSample.Web/wwwroot/web.config | 9 + .../IsbnDigitScheme10Constraint.cs | 3 +- .../IsbnDigitScheme13Constraint.cs | 2 +- .../Controllers/HomeController.cs | 5 +- .../Controllers/Isbn10Controller.cs | 16 + .../Controllers/Isbn13Controller.cs | 17 + .../Controllers/ProductsController.cs | 8 +- .../Controllers/StoreController.cs | 8 +- .../Controllers/UsersController.cs | 3 +- .../InlineConstraintSample.Web.xproj | 4 +- samples/InlineConstraintSample.Web/Startup.cs | 50 + .../Views/Home/Index.cshtml | 0 .../Views/Shared/Error.cshtml | 0 .../Views/Shared/_Layout.cshtml | 0 .../InlineConstraintSample.Web/project.json | 15 + .../InlineConstraintSample.Web}/readme.md | 6 +- .../wwwroot/web.config | 9 + .../Controllers/HomeController.cs | 6 +- .../JsonPatchSample.Web.xproj | 4 +- .../JsonPatchSample.Web/Models/Category.cs | 9 +- .../JsonPatchSample.Web}/Models/Customer.cs | 2 +- .../JsonPatchSample.Web}/Models/Order.cs | 2 +- .../JsonPatchSample.Web/Models/Product.cs | 8 +- .../ProductCategoryConverter.cs | 4 +- .../ReplaceOrderTypeConverter.cs | 2 +- .../JsonPatchSample.Web}/Startup.cs | 4 +- samples/JsonPatchSample.Web/project.json | 15 + .../JsonPatchSample.Web}/readme.md | 2 +- .../JsonPatchSample.Web/wwwroot/web.config | 9 + .../Controllers/HomeController.cs | 4 +- .../LocalizationSample.Web.xproj | 4 +- .../LocalizationSample.Web/Models/Product.cs | 13 + .../LocalizationSample.Web}/Models/User.cs | 8 +- ...ple.Web.Controllers.HomeController.fr.resx | 0 ...alizationSample.Web.Models.Product.fr.resx | 0 ...LocalizationSample.Web.Models.User.fr.resx | 0 .../Views.Home.Locpage.cshtml.en-GB.resx | 0 .../Views.Home.Locpage.cshtml.fr.resx | 0 ....Shared._LocalizationLayout.cshtml.fr.resx | 0 .../LocalizationSample.Web}/Startup.cs | 4 +- .../Views/Home/GetInvalidUser.cshtml | 2 +- .../Views/Home/Index.cshtml | 0 .../Views/Home/Index.en-GB.cshtml | 0 .../Views/Home/Index.fr.cshtml | 0 .../Views/Home/Locpage.cshtml | 0 .../Views/Home/_MyPartial.cshtml | 0 .../Views/Home/_Partial.cshtml | 0 .../Views/Home/_Partial.fr.cshtml | 0 .../Views/Shared/_LocalizationLayout.cshtml | 0 .../Views/Shared/_MyLayout.cshtml | 0 .../Views/Shared/_MyLayout.fr.cshtml | 0 .../Views/Shared/_MyPartial.en-GB.cshtml | 0 .../Views/_ViewImports.cshtml | 4 +- samples/LocalizationSample.Web/project.json | 15 + samples/LocalizationSample.Web/readme.md | 4 + .../LocalizationSample.Web/wwwroot/web.config | 9 + .../ActionResultTests.cs | 315 --- .../ActivatorTests.cs | 156 -- .../ApplicationModelTest.cs | 2 +- .../ControllerDiscoveryConventionTests.cs | 90 - ...mRouteTest.cs => CustomRouteSampleTest.cs} | 8 +- ...ivityTest.cs => EmbeddedViewSampleTest.cs} | 34 +- ...lteredDefaultAssemblyProviderFixtureOfT.cs | 41 - ...ilterTest.cs => FormatFilterSampleTest.cs} | 5 +- ...Tests.cs => InlineConstraintSampleTest.cs} | 88 +- ...sonPatchTest.cs => JsonPatchSampleTest.cs} | 6 +- ...ationTest.cs => LocalizationSampleTest.cs} | 8 +- .../Logging/LoggingAssert.cs | 96 - .../Logging/LoggingExtensions.cs | 161 -- .../ModelBindingBindingBehaviorTest.cs | 123 -- .../ModelBindingDataMemberRequiredTest.cs | 83 - .../ModelBindingFromFormTest.cs | 141 -- .../ModelBindingFromHeaderTest.cs | 296 --- .../ModelBindingFromQueryTest.cs | 115 -- .../ModelBindingFromRouteTest.cs | 79 - .../ModelBindingModelBinderAttributeTest.cs | 114 - .../ModelBindingTest.cs | 1835 ----------------- .../RazorEmbeddedViewsTest.cs | 46 - .../RoundTripTests.cs | 137 -- .../RoutingLowercaseUrlTest.cs | 48 - .../project.json | 18 +- .../ActionResultsWebSite.xproj | 18 - .../ActionResultsVerificationController.cs | 158 -- .../Controllers/HomeController.cs | 33 - .../Controllers/XmlSerializerController.cs | 33 - .../ActionResultsWebSite/GuidLookupService.cs | 12 - .../ActionResultsWebSite/Models/DummyClass.cs | 16 - test/WebSites/ActionResultsWebSite/Startup.cs | 39 - .../ActionResultsWebSite/project.json | 19 - test/WebSites/ActionResultsWebSite/readme.md | 4 - .../wwwroot/HelloWorld.htm | 1 - .../ActivatorWebSite/ActivatorWebSite.xproj | 18 - .../Components/CannotBeActivatedComponent.cs | 24 - .../Components/NumberComponent.cs | 23 - .../Components/TestComponent.cs | 16 - .../CannotBeActivatedController.cs | 23 - .../Controllers/PlainController.cs | 26 - .../Controllers/RegularController.cs | 23 - .../Controllers/ViewController.cs | 48 - test/WebSites/ActivatorWebSite/Models/Item.cs | 10 - .../ActivatorWebSite/Services/MyService.cs | 13 - .../ActivatorWebSite/Services/ViewService.cs | 26 - test/WebSites/ActivatorWebSite/Startup.cs | 35 - .../TagHelpers/FooterTagHelper.cs | 25 - .../TagHelpers/HiddenTagHelper.cs | 40 - .../TagHelpers/RepeatContentTagHelper.cs | 49 - .../TagHelpers/TitleTagHelper.cs | 36 - .../ConsumeCannotBeActivatedComponent.cshtml | 1 - .../View/ConsumeDefaultProperties.cshtml | 1 - .../Views/View/ConsumeInjectedService.cshtml | 5 - .../View/ConsumeServicesFromBaseType.cshtml | 1 - .../Views/View/ConsumeViewComponent.cshtml | 1 - .../Views/View/UseTagHelper.cshtml | 14 - test/WebSites/ActivatorWebSite/project.json | 18 - test/WebSites/ActivatorWebSite/readme.md | 4 - .../ActivatorWebSite/wwwroot/HelloWorld.htm | 1 - .../Controllers/LisenceController.cs | 8 +- .../ControllerLicenseConvention.cs | 2 +- .../AbstractController.cs | 13 - .../ChildOfAbstract.cs | 10 - ...ontrollerDiscoveryConventionsWebSite.xproj | 18 - .../NonControllerController.cs | 16 - .../PersonApi.cs | 15 - .../PocoController.cs | 13 - .../SqlTransactionManager.cs | 13 - .../Startup.cs | 27 - .../project.json | 20 - .../readme.md | 1 - .../wwwroot/HelloWorld.htm | 1 - test/WebSites/CustomRouteWebSite/project.json | 18 - .../CustomRouteWebSite/wwwroot/HelloWorld.htm | 1 - .../FormatFilterWebSite/Models/Product.cs | 14 - .../WebSites/FormatFilterWebSite/project.json | 18 - test/WebSites/FormatFilterWebSite/readme.md | 5 - .../wwwroot/HelloWorld.htm | 1 - .../InlineConstraints_Isbn10Controller.cs | 13 - .../InlineConstraints_Isbn13Controller.cs | 15 - .../InlineConstraintsWebSite/Startup.cs | 71 - .../InlineConstraintsWebSite/project.json | 18 - .../wwwroot/HelloWorld.htm | 1 - test/WebSites/JsonPatchWebSite/project.json | 18 - .../JsonPatchWebSite/wwwroot/HelloWorld.htm | 1 - .../WebSites/LocalizationWebSite/project.json | 17 - test/WebSites/LocalizationWebSite/readme.md | 4 - .../wwwroot/HelloWorld.htm | 1 - .../ElmLogSerializerMiddleware.cs | 117 -- .../LoggingWebSite/LoggingWebSite.xproj | 18 - .../Models/ActivityContextDto.cs | 15 - .../LoggingWebSite/Models/LogInfoDto.cs | 24 - .../LoggingWebSite/Models/RequestInfoDto.cs | 30 - .../LoggingWebSite/Models/ScopeNodeDto.cs | 18 - .../Properties/debugSettings.json | 3 - test/WebSites/LoggingWebSite/Startup.cs | 49 - .../LoggingWebSite/Views/Home/Index.cshtml | 1 - .../Views/Shared/_Layout.cshtml | 30 - test/WebSites/LoggingWebSite/project.json | 26 - test/WebSites/LoggingWebSite/readme.md | 4 - .../LoggingWebSite/wwwroot/HelloWorld.htm | 1 - .../Controllers/BlogController.cs | 27 - .../Controllers/EmployeeController.cs | 21 - .../LowercaseUrlsWebSite.xproj | 18 - test/WebSites/LowercaseUrlsWebSite/Startup.cs | 31 - .../LowercaseUrlsWebSite/project.json | 18 - test/WebSites/LowercaseUrlsWebSite/readme.md | 3 - .../wwwroot/HelloWorld.htm | 1 - .../AdditionalValuesMetadataProvider.cs | 33 - .../ModelBindingWebSite/CaculatorContext.cs | 16 - .../Controllers/BindAttributeController.cs | 151 -- .../Controllers/BindingBehaviorController.cs | 23 - .../Controllers/CompositeTestController.cs | 26 - .../DataMemberRequiredController.cs | 23 - .../Controllers/FileUploadController.cs | 96 - .../Controllers/FormCollectionController.cs | 39 - .../Controllers/FromAttributesController.cs | 54 - .../FromBodyControllerPropertyController.cs | 25 - .../FromFormAttribute_CompanyController.cs | 46 - .../Controllers/FromHeader_BlogController.cs | 136 -- .../FromQueryAttribute_CompanyController.cs | 46 - .../FromRouteAttribute_CompanyController.cs | 42 - .../FromServices_CalculatorController.cs | 25 - .../Controllers/HomeController.cs | 117 -- .../ModelBinderAttribute_CompanyController.cs | 24 - .../ModelBinderAttribute_ProductController.cs | 113 - .../Controllers/ModelMetadataController.cs | 35 - .../Person_CollectionBinderController.cs | 37 - .../PropertiesGetCreatedController.cs | 26 - .../Controllers/RoundtripController.cs | 90 - .../Controllers/TryUpdateModelController.cs | 226 -- .../Controllers/ValidationController.cs | 28 - .../Controllers/VehicleController.cs | 140 -- .../WithBinderMetadataController.cs | 35 - .../WithoutBinderMetadataController.cs | 28 - .../ModelBindingWebSite/DefaultCalculator.cs | 32 - .../DefaultCalculatorContext.cs | 10 - .../FromNonExistantBinderAttribute.cs | 19 - .../ModelBindingWebSite/FromTestAttribute.cs | 21 - .../ModelBindingWebSite/ICalculator.cs | 10 - .../ModelBindingWebSite/ITestService.cs | 10 - .../ModelBindingWebSite.xproj | 18 - .../ModelMetadataExtensions.cs | 26 - .../ModelBindingWebSite/Models/Address.cs | 18 - .../Models/BindingBehaviorModel.cs | 25 - .../ModelBindingWebSite/Models/Book.cs | 14 - .../ModelBindingWebSite/Models/Company.cs | 17 - .../ModelBindingWebSite/Models/Country.cs | 23 - .../ModelBindingWebSite/Models/Customer.cs | 15 - .../Models/DataMemberRequiredModel.cs | 20 - .../ModelBindingWebSite/Models/Department.cs | 12 - .../ModelBindingWebSite/Models/Document.cs | 14 - .../ModelBindingWebSite/Models/Employee.cs | 29 - .../Models/EmployeeWithBinderMetadata.cs | 15 - .../ModelBindingWebSite/Models/FileDetails.cs | 12 - .../Models/LargeModelWithValidation.cs | 34 - .../ModelBindingWebSite/Models/Line.cs | 17 - .../Models/MixedUser_FromBody.cs | 23 - .../Models/MixedUser_FromForm.cs | 19 - .../Models/ModelWithValidation.cs | 19 - .../ModelBindingWebSite/Models/PeopleModel.cs | 12 - .../ModelBindingWebSite/Models/Person.cs | 20 - .../Models/PersonAddress.cs | 14 - .../Models/PersonWithNoProperties.cs | 10 - .../ModelBindingWebSite/Models/Point.cs | 16 - .../ModelBindingWebSite/Models/Resident.cs | 18 - .../Models/StreetAddress.cs | 10 - .../ModelBindingWebSite/Models/User.cs | 20 - .../Models/UserPreference.cs | 12 - .../Models/UserWithAddress.cs | 12 - test/WebSites/ModelBindingWebSite/Result.cs | 12 - .../Services/IVehicleService.cs | 12 - .../Services/VehicleService.cs | 21 - test/WebSites/ModelBindingWebSite/Startup.cs | 47 - .../TestBindingSourceModelBinder.cs | 47 - .../ModelBindingWebSite/TestService.cs | 10 - .../ViewModels/DealerViewModel.cs | 22 - .../ViewModels/VehicleViewModel.cs | 57 - .../ViewModels/VehicleWithDealerViewModel.cs | 43 - .../Views/Vehicle/Details.cshtml | 13 - .../Views/Vehicle/Edit.cshtml | 19 - .../Views/Vehicle/UpdateSuccessful.cshtml | 26 - .../Views/Vehicle/UpdateVehicle.cshtml | 20 - .../WebSites/ModelBindingWebSite/project.json | 19 - test/WebSites/ModelBindingWebSite/readme.md | 6 - .../wwwroot/HelloWorld.htm | 1 - .../RazorEmbeddedViews_HomeController.cs | 15 - .../RazorEmbeddedViewsWebSite/project.json | 20 - .../wwwroot/HelloWorld.htm | 1 - 277 files changed, 654 insertions(+), 8604 deletions(-) rename test/WebSites/CustomRouteWebSite/Controllers/Canada/CustomRoute_ProductsController.cs => samples/CustomRouteSample.Web/Controllers/Canada/ProductsController.cs (74%) rename test/WebSites/CustomRouteWebSite/Controllers/CustomRoute_OrdersControlller.cs => samples/CustomRouteSample.Web/Controllers/OrdersControlller.cs (69%) rename test/WebSites/CustomRouteWebSite/Controllers/Spain/CustomRoute_ProductsController.cs => samples/CustomRouteSample.Web/Controllers/Spain/ProductsController.cs (74%) rename test/WebSites/CustomRouteWebSite/Controllers/US/CustomRoute_ProductsController.cs => samples/CustomRouteSample.Web/Controllers/US/ProductsController.cs (75%) rename test/WebSites/CustomRouteWebSite/CustomRouteWebSite.xproj => samples/CustomRouteSample.Web/CustomRouteSample.Web.xproj (81%) rename {test/WebSites/CustomRouteWebSite => samples/CustomRouteSample.Web}/LocaleAttribute.cs (92%) rename {test/WebSites/CustomRouteWebSite => samples/CustomRouteSample.Web}/LocalizedRoute.cs (97%) rename {test/WebSites/CustomRouteWebSite => samples/CustomRouteSample.Web}/Startup.cs (91%) create mode 100644 samples/CustomRouteSample.Web/project.json rename {test/WebSites/CustomRouteWebSite => samples/CustomRouteSample.Web}/readme.md (58%) create mode 100644 samples/CustomRouteSample.Web/wwwroot/web.config rename test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_AdminController.cs => samples/EmbeddedViewSample.Web/Controllers/AdminController.cs (73%) rename {test/WebSites/LoggingWebSite => samples/EmbeddedViewSample.Web}/Controllers/HomeController.cs (67%) rename {test/WebSites/RazorEmbeddedViewsWebSite/EmbeddedResources/Areas/Restricted/Views/RazorEmbeddedViews_Admin => samples/EmbeddedViewSample.Web/EmbeddedResources/Areas/Restricted/Views/Admin}/Login.cshtml (100%) rename test/WebSites/RazorEmbeddedViewsWebSite/EmbeddedResources/Views/RazorEmbeddedViews_Home/Index.cshtml => samples/EmbeddedViewSample.Web/EmbeddedResources/Views/Home/EchoActionUrl.cshtml (100%) create mode 100644 samples/EmbeddedViewSample.Web/EmbeddedResources/Views/Home/Index.cshtml rename test/WebSites/RazorEmbeddedViewsWebSite/RazorEmbeddedViewsWebSite.xproj => samples/EmbeddedViewSample.Web/EmbeddedViewSample.Web.xproj (81%) rename {test/WebSites/RazorEmbeddedViewsWebSite => samples/EmbeddedViewSample.Web}/Startup.cs (68%) create mode 100644 samples/EmbeddedViewSample.Web/project.json rename {test/WebSites/RazorEmbeddedViewsWebSite => samples/EmbeddedViewSample.Web}/readme.md (76%) create mode 100644 samples/EmbeddedViewSample.Web/wwwroot/web.config rename {test/WebSites/FormatFilterWebSite => samples/FormatFilterSample.Web}/Controllers/FormatFilterController.cs (74%) rename {test/WebSites/FormatFilterWebSite => samples/FormatFilterSample.Web}/Controllers/ProducesOverrideClass.cs (69%) rename {test/WebSites/FormatFilterWebSite => samples/FormatFilterSample.Web}/CustomFormatter.cs (78%) rename test/WebSites/FormatFilterWebSite/FormatFilterWebSite.xproj => samples/FormatFilterSample.Web/FormatFilterSample.Web.xproj (81%) create mode 100644 samples/FormatFilterSample.Web/Models/Product.cs rename {test/WebSites/FormatFilterWebSite => samples/FormatFilterSample.Web}/Startup.cs (64%) create mode 100644 samples/FormatFilterSample.Web/project.json create mode 100644 samples/FormatFilterSample.Web/readme.md create mode 100644 samples/FormatFilterSample.Web/wwwroot/web.config rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Constraints/IsbnDigitScheme10Constraint.cs (97%) rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Constraints/IsbnDigitScheme13Constraint.cs (96%) rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Controllers/HomeController.cs (70%) create mode 100644 samples/InlineConstraintSample.Web/Controllers/Isbn10Controller.cs create mode 100644 samples/InlineConstraintSample.Web/Controllers/Isbn13Controller.cs rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Controllers/ProductsController.cs (94%) rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Controllers/StoreController.cs (70%) rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Controllers/UsersController.cs (78%) rename test/WebSites/InlineConstraintsWebSite/InlineConstraintsWebSite.xproj => samples/InlineConstraintSample.Web/InlineConstraintSample.Web.xproj (81%) create mode 100644 samples/InlineConstraintSample.Web/Startup.cs rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Views/Home/Index.cshtml (100%) rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Views/Shared/Error.cshtml (100%) rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/Views/Shared/_Layout.cshtml (100%) create mode 100644 samples/InlineConstraintSample.Web/project.json rename {test/WebSites/InlineConstraintsWebSite => samples/InlineConstraintSample.Web}/readme.md (63%) create mode 100644 samples/InlineConstraintSample.Web/wwwroot/web.config rename test/WebSites/JsonPatchWebSite/Controllers/JsonPatchController.cs => samples/JsonPatchSample.Web/Controllers/HomeController.cs (95%) rename test/WebSites/JsonPatchWebSite/JsonPatchWebSite.xproj => samples/JsonPatchSample.Web/JsonPatchSample.Web.xproj (81%) rename test/WebSites/JsonPatchWebSite/Models/Product.cs => samples/JsonPatchSample.Web/Models/Category.cs (66%) rename {test/WebSites/JsonPatchWebSite => samples/JsonPatchSample.Web}/Models/Customer.cs (89%) rename {test/WebSites/JsonPatchWebSite => samples/JsonPatchSample.Web}/Models/Order.cs (90%) rename test/WebSites/ModelBindingWebSite/Models/ArrayOfPersonWithNoProperties.cs => samples/JsonPatchSample.Web/Models/Product.cs (53%) rename {test/WebSites/JsonPatchWebSite => samples/JsonPatchSample.Web}/ProductCategoryConverter.cs (96%) rename {test/WebSites/JsonPatchWebSite => samples/JsonPatchSample.Web}/ReplaceOrderTypeConverter.cs (96%) rename {test/WebSites/JsonPatchWebSite => samples/JsonPatchSample.Web}/Startup.cs (90%) create mode 100644 samples/JsonPatchSample.Web/project.json rename {test/WebSites/JsonPatchWebSite => samples/JsonPatchSample.Web}/readme.md (79%) create mode 100644 samples/JsonPatchSample.Web/wwwroot/web.config rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Controllers/HomeController.cs (92%) rename test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj => samples/LocalizationSample.Web/LocalizationSample.Web.xproj (81%) create mode 100644 samples/LocalizationSample.Web/Models/Product.cs rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Models/User.cs (69%) rename test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Controllers.HomeController.fr.resx => samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Controllers.HomeController.fr.resx (100%) rename test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.Product.fr.resx => samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Models.Product.fr.resx (100%) rename test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.User.fr.resx => samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Models.User.fr.resx (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Resources/Views.Home.Locpage.cshtml.en-GB.resx (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Resources/Views.Home.Locpage.cshtml.fr.resx (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Resources/Views.Shared._LocalizationLayout.cshtml.fr.resx (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Startup.cs (94%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/GetInvalidUser.cshtml (76%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/Index.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/Index.en-GB.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/Index.fr.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/Locpage.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/_MyPartial.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/_Partial.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Home/_Partial.fr.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Shared/_LocalizationLayout.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Shared/_MyLayout.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Shared/_MyLayout.fr.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/Shared/_MyPartial.en-GB.cshtml (100%) rename {test/WebSites/LocalizationWebSite => samples/LocalizationSample.Web}/Views/_ViewImports.cshtml (57%) create mode 100644 samples/LocalizationSample.Web/project.json create mode 100644 samples/LocalizationSample.Web/readme.md create mode 100644 samples/LocalizationSample.Web/wwwroot/web.config delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ActionResultTests.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ActivatorTests.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs rename test/Microsoft.AspNet.Mvc.FunctionalTests/{CustomRouteTest.cs => CustomRouteSampleTest.cs} (87%) rename test/Microsoft.AspNet.Mvc.FunctionalTests/{RazorFileSystemCaseSensitivityTest.cs => EmbeddedViewSampleTest.cs} (53%) delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/FilteredDefaultAssemblyProviderFixtureOfT.cs rename test/Microsoft.AspNet.Mvc.FunctionalTests/{FormatFilterTest.cs => FormatFilterSampleTest.cs} (93%) rename test/Microsoft.AspNet.Mvc.FunctionalTests/{InlineConstraintTests.cs => InlineConstraintSampleTest.cs} (85%) rename test/Microsoft.AspNet.Mvc.FunctionalTests/{JsonPatchTest.cs => JsonPatchSampleTest.cs} (98%) rename test/Microsoft.AspNet.Mvc.FunctionalTests/{LocalizationTest.cs => LocalizationSampleTest.cs} (93%) delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingAssert.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingExtensions.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingBindingBehaviorTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingDataMemberRequiredTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromFormTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromHeaderTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromQueryTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromRouteTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingModelBinderAttributeTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/RazorEmbeddedViewsTest.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/RoundTripTests.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/RoutingLowercaseUrlTest.cs delete mode 100644 test/WebSites/ActionResultsWebSite/ActionResultsWebSite.xproj delete mode 100644 test/WebSites/ActionResultsWebSite/Controllers/ActionResultsVerificationController.cs delete mode 100644 test/WebSites/ActionResultsWebSite/Controllers/HomeController.cs delete mode 100644 test/WebSites/ActionResultsWebSite/Controllers/XmlSerializerController.cs delete mode 100644 test/WebSites/ActionResultsWebSite/GuidLookupService.cs delete mode 100644 test/WebSites/ActionResultsWebSite/Models/DummyClass.cs delete mode 100644 test/WebSites/ActionResultsWebSite/Startup.cs delete mode 100644 test/WebSites/ActionResultsWebSite/project.json delete mode 100644 test/WebSites/ActionResultsWebSite/readme.md delete mode 100644 test/WebSites/ActionResultsWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/ActivatorWebSite/ActivatorWebSite.xproj delete mode 100644 test/WebSites/ActivatorWebSite/Components/CannotBeActivatedComponent.cs delete mode 100644 test/WebSites/ActivatorWebSite/Components/NumberComponent.cs delete mode 100644 test/WebSites/ActivatorWebSite/Components/TestComponent.cs delete mode 100644 test/WebSites/ActivatorWebSite/Controllers/CannotBeActivatedController.cs delete mode 100644 test/WebSites/ActivatorWebSite/Controllers/PlainController.cs delete mode 100644 test/WebSites/ActivatorWebSite/Controllers/RegularController.cs delete mode 100644 test/WebSites/ActivatorWebSite/Controllers/ViewController.cs delete mode 100644 test/WebSites/ActivatorWebSite/Models/Item.cs delete mode 100644 test/WebSites/ActivatorWebSite/Services/MyService.cs delete mode 100644 test/WebSites/ActivatorWebSite/Services/ViewService.cs delete mode 100644 test/WebSites/ActivatorWebSite/Startup.cs delete mode 100644 test/WebSites/ActivatorWebSite/TagHelpers/FooterTagHelper.cs delete mode 100644 test/WebSites/ActivatorWebSite/TagHelpers/HiddenTagHelper.cs delete mode 100644 test/WebSites/ActivatorWebSite/TagHelpers/RepeatContentTagHelper.cs delete mode 100644 test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs delete mode 100644 test/WebSites/ActivatorWebSite/Views/View/ConsumeCannotBeActivatedComponent.cshtml delete mode 100644 test/WebSites/ActivatorWebSite/Views/View/ConsumeDefaultProperties.cshtml delete mode 100644 test/WebSites/ActivatorWebSite/Views/View/ConsumeInjectedService.cshtml delete mode 100644 test/WebSites/ActivatorWebSite/Views/View/ConsumeServicesFromBaseType.cshtml delete mode 100644 test/WebSites/ActivatorWebSite/Views/View/ConsumeViewComponent.cshtml delete mode 100644 test/WebSites/ActivatorWebSite/Views/View/UseTagHelper.cshtml delete mode 100644 test/WebSites/ActivatorWebSite/project.json delete mode 100644 test/WebSites/ActivatorWebSite/readme.md delete mode 100644 test/WebSites/ActivatorWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/AbstractController.cs delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/ChildOfAbstract.cs delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/ControllerDiscoveryConventionsWebSite.xproj delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/NonControllerController.cs delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/PersonApi.cs delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/PocoController.cs delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/SqlTransactionManager.cs delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/Startup.cs delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/project.json delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/readme.md delete mode 100644 test/WebSites/ControllerDiscoveryConventionsWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/CustomRouteWebSite/project.json delete mode 100644 test/WebSites/CustomRouteWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/FormatFilterWebSite/Models/Product.cs delete mode 100644 test/WebSites/FormatFilterWebSite/project.json delete mode 100644 test/WebSites/FormatFilterWebSite/readme.md delete mode 100644 test/WebSites/FormatFilterWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn10Controller.cs delete mode 100644 test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn13Controller.cs delete mode 100644 test/WebSites/InlineConstraintsWebSite/Startup.cs delete mode 100644 test/WebSites/InlineConstraintsWebSite/project.json delete mode 100644 test/WebSites/InlineConstraintsWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/JsonPatchWebSite/project.json delete mode 100644 test/WebSites/JsonPatchWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/LocalizationWebSite/project.json delete mode 100644 test/WebSites/LocalizationWebSite/readme.md delete mode 100644 test/WebSites/LocalizationWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/LoggingWebSite/ElmLogSerializerMiddleware.cs delete mode 100644 test/WebSites/LoggingWebSite/LoggingWebSite.xproj delete mode 100644 test/WebSites/LoggingWebSite/Models/ActivityContextDto.cs delete mode 100644 test/WebSites/LoggingWebSite/Models/LogInfoDto.cs delete mode 100644 test/WebSites/LoggingWebSite/Models/RequestInfoDto.cs delete mode 100644 test/WebSites/LoggingWebSite/Models/ScopeNodeDto.cs delete mode 100644 test/WebSites/LoggingWebSite/Properties/debugSettings.json delete mode 100644 test/WebSites/LoggingWebSite/Startup.cs delete mode 100644 test/WebSites/LoggingWebSite/Views/Home/Index.cshtml delete mode 100644 test/WebSites/LoggingWebSite/Views/Shared/_Layout.cshtml delete mode 100644 test/WebSites/LoggingWebSite/project.json delete mode 100644 test/WebSites/LoggingWebSite/readme.md delete mode 100644 test/WebSites/LoggingWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/LowercaseUrlsWebSite/Controllers/BlogController.cs delete mode 100644 test/WebSites/LowercaseUrlsWebSite/Controllers/EmployeeController.cs delete mode 100644 test/WebSites/LowercaseUrlsWebSite/LowercaseUrlsWebSite.xproj delete mode 100644 test/WebSites/LowercaseUrlsWebSite/Startup.cs delete mode 100644 test/WebSites/LowercaseUrlsWebSite/project.json delete mode 100644 test/WebSites/LowercaseUrlsWebSite/readme.md delete mode 100644 test/WebSites/LowercaseUrlsWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/ModelBindingWebSite/AdditionalValuesMetadataProvider.cs delete mode 100644 test/WebSites/ModelBindingWebSite/CaculatorContext.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/BindAttributeController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/BindingBehaviorController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/CompositeTestController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/DataMemberRequiredController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FileUploadController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FormCollectionController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FromAttributesController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FromBodyControllerPropertyController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FromFormAttribute_CompanyController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FromHeader_BlogController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FromQueryAttribute_CompanyController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FromRouteAttribute_CompanyController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/FromServices_CalculatorController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/HomeController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_CompanyController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_ProductController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/ModelMetadataController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/Person_CollectionBinderController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/PropertiesGetCreatedController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/RoundtripController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/TryUpdateModelController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/ValidationController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/VehicleController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/WithBinderMetadataController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Controllers/WithoutBinderMetadataController.cs delete mode 100644 test/WebSites/ModelBindingWebSite/DefaultCalculator.cs delete mode 100644 test/WebSites/ModelBindingWebSite/DefaultCalculatorContext.cs delete mode 100644 test/WebSites/ModelBindingWebSite/FromNonExistantBinderAttribute.cs delete mode 100644 test/WebSites/ModelBindingWebSite/FromTestAttribute.cs delete mode 100644 test/WebSites/ModelBindingWebSite/ICalculator.cs delete mode 100644 test/WebSites/ModelBindingWebSite/ITestService.cs delete mode 100644 test/WebSites/ModelBindingWebSite/ModelBindingWebSite.xproj delete mode 100644 test/WebSites/ModelBindingWebSite/ModelMetadataExtensions.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Address.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/BindingBehaviorModel.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Book.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Company.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Country.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Customer.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/DataMemberRequiredModel.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Department.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Document.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Employee.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/EmployeeWithBinderMetadata.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/FileDetails.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/LargeModelWithValidation.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Line.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/MixedUser_FromBody.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/MixedUser_FromForm.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/ModelWithValidation.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/PeopleModel.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Person.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/PersonAddress.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/PersonWithNoProperties.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Point.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/Resident.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/StreetAddress.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/User.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/UserPreference.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Models/UserWithAddress.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Result.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Services/IVehicleService.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Services/VehicleService.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Startup.cs delete mode 100644 test/WebSites/ModelBindingWebSite/TestBindingSourceModelBinder.cs delete mode 100644 test/WebSites/ModelBindingWebSite/TestService.cs delete mode 100644 test/WebSites/ModelBindingWebSite/ViewModels/DealerViewModel.cs delete mode 100644 test/WebSites/ModelBindingWebSite/ViewModels/VehicleViewModel.cs delete mode 100644 test/WebSites/ModelBindingWebSite/ViewModels/VehicleWithDealerViewModel.cs delete mode 100644 test/WebSites/ModelBindingWebSite/Views/Vehicle/Details.cshtml delete mode 100644 test/WebSites/ModelBindingWebSite/Views/Vehicle/Edit.cshtml delete mode 100644 test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateSuccessful.cshtml delete mode 100644 test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateVehicle.cshtml delete mode 100644 test/WebSites/ModelBindingWebSite/project.json delete mode 100644 test/WebSites/ModelBindingWebSite/readme.md delete mode 100644 test/WebSites/ModelBindingWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_HomeController.cs delete mode 100644 test/WebSites/RazorEmbeddedViewsWebSite/project.json delete mode 100644 test/WebSites/RazorEmbeddedViewsWebSite/wwwroot/HelloWorld.htm diff --git a/Mvc.NoFun.sln b/Mvc.NoFun.sln index 1c9048948..249751771 100644 --- a/Mvc.NoFun.sln +++ b/Mvc.NoFun.sln @@ -87,6 +87,18 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MvcSandbox", "samples\MvcSa EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "UrlHelperSample.Web", "samples\UrlHelperSample.Web\UrlHelperSample.Web.xproj", "{73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CustomRouteSample.Web", "samples\CustomRouteSample.Web\CustomRouteSample.Web.xproj", "{364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EmbeddedViewSample.Web", "samples\EmbeddedViewSample.Web\EmbeddedViewSample.Web.xproj", "{B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FormatFilterSample.Web", "samples\FormatFilterSample.Web\FormatFilterSample.Web.xproj", "{AC9BE567-540E-4C70-90C2-AAF021307A80}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "InlineConstraintSample.Web", "samples\InlineConstraintSample.Web\InlineConstraintSample.Web.xproj", "{EA34877F-1AC1-42B7-B4E6-15A093F40CAE}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "JsonPatchSample.Web", "samples\JsonPatchSample.Web\JsonPatchSample.Web.xproj", "{DAB1252D-577C-4912-98BE-1A812BF83F86}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LocalizationSample.Web", "samples\LocalizationSample.Web\LocalizationSample.Web.xproj", "{FCFE6024-2720-49B4-8257-9DBC6114F0F1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -507,6 +519,78 @@ Global {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}.Release|Mixed Platforms.Build.0 = Release|Any CPU {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}.Release|x86.ActiveCfg = Release|Any CPU {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}.Release|x86.Build.0 = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|x86.ActiveCfg = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|x86.Build.0 = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Any CPU.Build.0 = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|x86.ActiveCfg = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|x86.Build.0 = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|x86.ActiveCfg = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|x86.Build.0 = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Any CPU.Build.0 = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|x86.ActiveCfg = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|x86.Build.0 = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|x86.ActiveCfg = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|x86.Build.0 = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Any CPU.Build.0 = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|x86.ActiveCfg = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|x86.Build.0 = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|x86.ActiveCfg = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|x86.Build.0 = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Any CPU.Build.0 = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|x86.ActiveCfg = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|x86.Build.0 = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|x86.ActiveCfg = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|x86.Build.0 = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Any CPU.Build.0 = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|x86.ActiveCfg = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|x86.Build.0 = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|x86.ActiveCfg = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|x86.Build.0 = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Any CPU.Build.0 = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.ActiveCfg = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -548,5 +632,11 @@ Global {9879B5D5-2325-4A81-B4DF-F279FE8FEEB4} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {14ED4476-9F24-4776-8417-EA6927F6C9C9} = {DAAE4C74-D06F-4874-A166-33305D2643CE} {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {AC9BE567-540E-4C70-90C2-AAF021307A80} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {DAB1252D-577C-4912-98BE-1A812BF83F86} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {FCFE6024-2720-49B4-8257-9DBC6114F0F1} = {DAAE4C74-D06F-4874-A166-33305D2643CE} EndGlobalSection EndGlobal diff --git a/Mvc.sln b/Mvc.sln index 8c0b0b761..bded2831d 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -29,10 +29,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Functi EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "BasicWebSite", "test\WebSites\BasicWebSite\BasicWebSite.xproj", "{34DF1487-12C6-476C-BE0A-F31DF1939AE5}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ActivatorWebSite", "test\WebSites\ActivatorWebSite\ActivatorWebSite.xproj", "{DB79BCBA-9538-4A53-87D9-77728E2BAA39}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "InlineConstraintsWebSite", "test\WebSites\InlineConstraintsWebSite\InlineConstraintsWebSite.xproj", "{EA34877F-1AC1-42B7-B4E6-15A093F40CAE}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.TestConfiguration", "test\WebSites\Microsoft.AspNet.Mvc.TestConfiguration\Microsoft.AspNet.Mvc.TestConfiguration.xproj", "{680D75ED-601F-4D86-B01B-1072D0C31B8C}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RoutingWebSite", "test\WebSites\RoutingWebSite\RoutingWebSite.xproj", "{42CDBF4A-E238-4C0F-A416-44588363EB4C}" @@ -43,8 +39,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorWebSite", "test\WebSit EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FormatterWebSite", "test\WebSites\FormatterWebSite\FormatterWebSite.xproj", "{62735776-46FF-4170-9392-02E128A69B89}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ModelBindingWebSite", "test\WebSites\ModelBindingWebSite\ModelBindingWebSite.xproj", "{EE1AB716-F102-4CA3-AD2C-214A44B459A0}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FAD65E9C-3CF3-4F68-9757-C7358604030B}" ProjectSection(SolutionItems) = preProject global.json = global.json @@ -80,44 +74,28 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.TagHel EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PrecompilationWebSite", "test\WebSites\PrecompilationWebSite\PrecompilationWebSite.xproj", "{59E1BE90-92C1-4D35-ADCC-B69F49077C81}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorEmbeddedViewsWebSite", "test\WebSites\RazorEmbeddedViewsWebSite\RazorEmbeddedViewsWebSite.xproj", "{B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CompositeViewEngineWebSite", "test\WebSites\CompositeViewEngineWebSite\CompositeViewEngineWebSite.xproj", "{A853B2BA-4449-4908-A416-5A3C027FC22B}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HtmlGenerationWebSite", "test\WebSites\HtmlGenerationWebSite\HtmlGenerationWebSite.xproj", "{920F8A0E-6F7D-4BBE-84FF-840B89099BE6}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ActionResultsWebSite", "test\WebSites\ActionResultsWebSite\ActionResultsWebSite.xproj", "{0A6BB4C0-48D3-4E7F-952B-B8917345E075}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoggingWebSite", "test\WebSites\LoggingWebSite\LoggingWebSite.xproj", "{0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ErrorPageMiddlewareWebSite", "test\WebSites\ErrorPageMiddlewareWebSite\ErrorPageMiddlewareWebSite.xproj", "{AD545A5B-2BA5-4314-88AC-FC2ACF2CC718}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ActionConstraintsWebSite", "test\WebSites\ActionConstraintsWebSite\ActionConstraintsWebSite.xproj", "{AF210F69-9D31-43AF-AC3A-CD366E252218}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CustomRouteWebSite", "test\WebSites\CustomRouteWebSite\CustomRouteWebSite.xproj", "{364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "XmlFormattersWebSite", "test\WebSites\XmlFormattersWebSite\XmlFormattersWebSite.xproj", "{C3123A70-41C4-4122-AD1C-D35DF8958DD7}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FormatFilterWebSite", "test\WebSites\FormatFilterWebSite\FormatFilterWebSite.xproj", "{AC9BE567-540E-4C70-90C2-AAF021307A80}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ControllersFromServicesWebSite", "test\WebSites\ControllersFromServicesWebSite\ControllersFromServicesWebSite.xproj", "{983741B2-4424-4ED1-9B03-7675A67230C8}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ControllersFromServicesClassLibrary", "test\WebSites\ControllersFromServicesClassLibrary\ControllersFromServicesClassLibrary.xproj", "{551DC89E-2A13-4CF2-83D7-1ADD802443D5}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "UserClassLibrary", "test\WebSites\UserClassLibrary\UserClassLibrary.xproj", "{C651F432-4EBE-41A6-BAD2-3E07CCBA209C}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ControllerDiscoveryConventionsWebSite", "test\WebSites\ControllerDiscoveryConventionsWebSite\ControllerDiscoveryConventionsWebSite.xproj", "{A19022EF-9BA3-4349-94E4-F48E13E1C8AE}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LowercaseUrlsWebSite", "test\WebSites\LowercaseUrlsWebSite\LowercaseUrlsWebSite.xproj", "{BCDB13A6-7D6E-485E-8424-A156432B71AC}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.TestCommon", "test\Microsoft.AspNet.Mvc.TestCommon\Microsoft.AspNet.Mvc.TestCommon.xproj", "{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CorsWebSite", "test\WebSites\CorsWebSite\CorsWebSite.xproj", "{94BA134D-04B3-48AA-BA55-5A4DB8640F2D}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CorsMiddlewareWebSite", "test\WebSites\CorsMiddlewareWebSite\CorsMiddlewareWebSite.xproj", "{B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "JsonPatchWebSite", "test\WebSites\JsonPatchWebSite\JsonPatchWebSite.xproj", "{DAB1252D-577C-4912-98BE-1A812BF83F86}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.IntegrationTests", "test\Microsoft.AspNet.Mvc.IntegrationTests\Microsoft.AspNet.Mvc.IntegrationTests.xproj", "{864FA09D-1E48-403A-A6C8-4F079D2A30F0}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Abstractions", "src\Microsoft.AspNet.Mvc.Abstractions\Microsoft.AspNet.Mvc.Abstractions.xproj", "{1154203C-7579-4525-906E-BC55268421C1}" @@ -128,8 +106,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ApiExp EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Abstractions.Test", "test\Microsoft.AspNet.Mvc.Abstractions.Test\Microsoft.AspNet.Mvc.Abstractions.Test.xproj", "{DA000953-7532-4DF5-8DB9-8143DF98D999}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LocalizationWebSite", "test\WebSites\LocalizationWebSite\LocalizationWebSite.xproj", "{FCFE6024-2720-49B4-8257-9DBC6114F0F1}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AntiforgeryTokenWebSite", "test\WebSites\AntiforgeryTokenWebSite\AntiforgeryTokenWebSite.xproj", "{A353B17E-A940-4CE8-8BF9-179E24A9041F}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MvcMinimalSample.Web", "samples\MvcMinimalSample.Web\MvcMinimalSample.Web.xproj", "{F21E225B-190B-4DAA-8B0A-05986D231F56}" @@ -164,6 +140,18 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MvcSandbox", "samples\MvcSa EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "UrlHelperSample.Web", "samples\UrlHelperSample.Web\UrlHelperSample.Web.xproj", "{73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CustomRouteSample.Web", "samples\CustomRouteSample.Web\CustomRouteSample.Web.xproj", "{364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EmbeddedViewSample.Web", "samples\EmbeddedViewSample.Web\EmbeddedViewSample.Web.xproj", "{B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FormatFilterSample.Web", "samples\FormatFilterSample.Web\FormatFilterSample.Web.xproj", "{AC9BE567-540E-4C70-90C2-AAF021307A80}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "InlineConstraintSample.Web", "samples\InlineConstraintSample.Web\InlineConstraintSample.Web.xproj", "{EA34877F-1AC1-42B7-B4E6-15A093F40CAE}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "JsonPatchSample.Web", "samples\JsonPatchSample.Web\JsonPatchSample.Web.xproj", "{DAB1252D-577C-4912-98BE-1A812BF83F86}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LocalizationSample.Web", "samples\LocalizationSample.Web\LocalizationSample.Web.xproj", "{FCFE6024-2720-49B4-8257-9DBC6114F0F1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -264,26 +252,6 @@ Global {34DF1487-12C6-476C-BE0A-F31DF1939AE5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {34DF1487-12C6-476C-BE0A-F31DF1939AE5}.Release|Mixed Platforms.Build.0 = Release|Any CPU {34DF1487-12C6-476C-BE0A-F31DF1939AE5}.Release|x86.ActiveCfg = Release|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Debug|x86.ActiveCfg = Debug|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Release|Any CPU.Build.0 = Release|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {DB79BCBA-9538-4A53-87D9-77728E2BAA39}.Release|x86.ActiveCfg = Release|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|x86.ActiveCfg = Debug|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Any CPU.Build.0 = Release|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|x86.ActiveCfg = Release|Any CPU {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -334,16 +302,6 @@ Global {62735776-46FF-4170-9392-02E128A69B89}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {62735776-46FF-4170-9392-02E128A69B89}.Release|Mixed Platforms.Build.0 = Release|Any CPU {62735776-46FF-4170-9392-02E128A69B89}.Release|x86.ActiveCfg = Release|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Debug|x86.ActiveCfg = Debug|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Release|Any CPU.Build.0 = Release|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {EE1AB716-F102-4CA3-AD2C-214A44B459A0}.Release|x86.ActiveCfg = Release|Any CPU {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Debug|Any CPU.Build.0 = Debug|Any CPU {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -494,18 +452,6 @@ Global {59E1BE90-92C1-4D35-ADCC-B69F49077C81}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {59E1BE90-92C1-4D35-ADCC-B69F49077C81}.Release|Mixed Platforms.Build.0 = Release|Any CPU {59E1BE90-92C1-4D35-ADCC-B69F49077C81}.Release|x86.ActiveCfg = Release|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|x86.ActiveCfg = Debug|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|x86.Build.0 = Debug|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Any CPU.Build.0 = Release|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|x86.ActiveCfg = Release|Any CPU - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|x86.Build.0 = Release|Any CPU {A853B2BA-4449-4908-A416-5A3C027FC22B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A853B2BA-4449-4908-A416-5A3C027FC22B}.Debug|Any CPU.Build.0 = Debug|Any CPU {A853B2BA-4449-4908-A416-5A3C027FC22B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -530,30 +476,6 @@ Global {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|Mixed Platforms.Build.0 = Release|Any CPU {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|x86.ActiveCfg = Release|Any CPU {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|x86.Build.0 = Release|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|x86.ActiveCfg = Debug|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|x86.Build.0 = Debug|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Release|Any CPU.Build.0 = Release|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Release|x86.ActiveCfg = Release|Any CPU - {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Release|x86.Build.0 = Release|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Debug|x86.ActiveCfg = Debug|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Debug|x86.Build.0 = Debug|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Release|Any CPU.Build.0 = Release|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Release|x86.ActiveCfg = Release|Any CPU - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}.Release|x86.Build.0 = Release|Any CPU {AD545A5B-2BA5-4314-88AC-FC2ACF2CC718}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AD545A5B-2BA5-4314-88AC-FC2ACF2CC718}.Debug|Any CPU.Build.0 = Debug|Any CPU {AD545A5B-2BA5-4314-88AC-FC2ACF2CC718}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -578,18 +500,6 @@ Global {AF210F69-9D31-43AF-AC3A-CD366E252218}.Release|Mixed Platforms.Build.0 = Release|Any CPU {AF210F69-9D31-43AF-AC3A-CD366E252218}.Release|x86.ActiveCfg = Release|Any CPU {AF210F69-9D31-43AF-AC3A-CD366E252218}.Release|x86.Build.0 = Release|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|x86.ActiveCfg = Debug|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|x86.Build.0 = Debug|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Any CPU.Build.0 = Release|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|x86.ActiveCfg = Release|Any CPU - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|x86.Build.0 = Release|Any CPU {C3123A70-41C4-4122-AD1C-D35DF8958DD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C3123A70-41C4-4122-AD1C-D35DF8958DD7}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3123A70-41C4-4122-AD1C-D35DF8958DD7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -602,18 +512,6 @@ Global {C3123A70-41C4-4122-AD1C-D35DF8958DD7}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C3123A70-41C4-4122-AD1C-D35DF8958DD7}.Release|x86.ActiveCfg = Release|Any CPU {C3123A70-41C4-4122-AD1C-D35DF8958DD7}.Release|x86.Build.0 = Release|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|x86.ActiveCfg = Debug|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|x86.Build.0 = Debug|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Any CPU.Build.0 = Release|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|x86.ActiveCfg = Release|Any CPU - {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|x86.Build.0 = Release|Any CPU {983741B2-4424-4ED1-9B03-7675A67230C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {983741B2-4424-4ED1-9B03-7675A67230C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {983741B2-4424-4ED1-9B03-7675A67230C8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -650,30 +548,6 @@ Global {C651F432-4EBE-41A6-BAD2-3E07CCBA209C}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C651F432-4EBE-41A6-BAD2-3E07CCBA209C}.Release|x86.ActiveCfg = Release|Any CPU {C651F432-4EBE-41A6-BAD2-3E07CCBA209C}.Release|x86.Build.0 = Release|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Debug|x86.ActiveCfg = Debug|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Debug|x86.Build.0 = Debug|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Release|Any CPU.Build.0 = Release|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Release|x86.ActiveCfg = Release|Any CPU - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE}.Release|x86.Build.0 = Release|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Debug|x86.ActiveCfg = Debug|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Debug|x86.Build.0 = Debug|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|Any CPU.Build.0 = Release|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|x86.ActiveCfg = Release|Any CPU - {BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|x86.Build.0 = Release|Any CPU {F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -709,18 +583,6 @@ Global {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Release|Mixed Platforms.Build.0 = Release|Any CPU {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Release|x86.ActiveCfg = Release|Any CPU {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Release|x86.Build.0 = Release|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|x86.ActiveCfg = Debug|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|x86.Build.0 = Debug|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Any CPU.Build.0 = Release|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|x86.ActiveCfg = Release|Any CPU - {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|x86.Build.0 = Release|Any CPU {864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Debug|Any CPU.Build.0 = Debug|Any CPU {864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -781,18 +643,6 @@ Global {DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Mixed Platforms.Build.0 = Release|Any CPU {DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|x86.ActiveCfg = Release|Any CPU {DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|x86.Build.0 = Release|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|x86.ActiveCfg = Debug|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|x86.Build.0 = Debug|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Any CPU.Build.0 = Release|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.ActiveCfg = Release|Any CPU - {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.Build.0 = Release|Any CPU {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Debug|Any CPU.Build.0 = Debug|Any CPU {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -997,6 +847,78 @@ Global {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}.Release|Mixed Platforms.Build.0 = Release|Any CPU {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}.Release|x86.ActiveCfg = Release|Any CPU {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191}.Release|x86.Build.0 = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|x86.ActiveCfg = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Debug|x86.Build.0 = Debug|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Any CPU.Build.0 = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|x86.ActiveCfg = Release|Any CPU + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B}.Release|x86.Build.0 = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|x86.ActiveCfg = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Debug|x86.Build.0 = Debug|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Any CPU.Build.0 = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|x86.ActiveCfg = Release|Any CPU + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D}.Release|x86.Build.0 = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|x86.ActiveCfg = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Debug|x86.Build.0 = Debug|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Any CPU.Build.0 = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|x86.ActiveCfg = Release|Any CPU + {AC9BE567-540E-4C70-90C2-AAF021307A80}.Release|x86.Build.0 = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|x86.ActiveCfg = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Debug|x86.Build.0 = Debug|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Any CPU.Build.0 = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|x86.ActiveCfg = Release|Any CPU + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE}.Release|x86.Build.0 = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|x86.ActiveCfg = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Debug|x86.Build.0 = Debug|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Any CPU.Build.0 = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|x86.ActiveCfg = Release|Any CPU + {DAB1252D-577C-4912-98BE-1A812BF83F86}.Release|x86.Build.0 = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|x86.ActiveCfg = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Debug|x86.Build.0 = Debug|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Any CPU.Build.0 = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.ActiveCfg = Release|Any CPU + {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1012,14 +934,11 @@ Global {16703B76-C9F7-4C75-AE6C-53D92E308E3C} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {323D0C04-B518-4A8F-8A8E-3546AD153D34} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {34DF1487-12C6-476C-BE0A-F31DF1939AE5} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {DB79BCBA-9538-4A53-87D9-77728E2BAA39} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {EA34877F-1AC1-42B7-B4E6-15A093F40CAE} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {680D75ED-601F-4D86-B01B-1072D0C31B8C} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {42CDBF4A-E238-4C0F-A416-44588363EB4C} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {5F945B82-FE5F-425C-956C-8BC2F2020254} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {B07CAF59-11ED-40E3-A5DB-E1178F84FA78} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {62735776-46FF-4170-9392-02E128A69B89} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {EE1AB716-F102-4CA3-AD2C-214A44B459A0} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {1976AC4A-FEA4-4587-A158-D9F79736D2B6} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {61061528-071E-424E-965A-07BCC2F02672} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} @@ -1035,31 +954,22 @@ Global {B2347320-308E-4D2B-AEC8-005DFA68B0C9} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {860119ED-3DB1-424D-8D0A-30132A8A7D96} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {59E1BE90-92C1-4D35-ADCC-B69F49077C81} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {A853B2BA-4449-4908-A416-5A3C027FC22B} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {920F8A0E-6F7D-4BBE-84FF-840B89099BE6} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {0A6BB4C0-48D3-4E7F-952B-B8917345E075} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {AD545A5B-2BA5-4314-88AC-FC2ACF2CC718} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {AF210F69-9D31-43AF-AC3A-CD366E252218} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {C3123A70-41C4-4122-AD1C-D35DF8958DD7} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {AC9BE567-540E-4C70-90C2-AAF021307A80} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {983741B2-4424-4ED1-9B03-7675A67230C8} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {551DC89E-2A13-4CF2-83D7-1ADD802443D5} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {C651F432-4EBE-41A6-BAD2-3E07CCBA209C} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {A19022EF-9BA3-4349-94E4-F48E13E1C8AE} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {BCDB13A6-7D6E-485E-8424-A156432B71AC} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {F504357E-C2E1-4818-BA5C-9A2EAC25FEE5} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {94BA134D-04B3-48AA-BA55-5A4DB8640F2D} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {DAB1252D-577C-4912-98BE-1A812BF83F86} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {864FA09D-1E48-403A-A6C8-4F079D2A30F0} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {1154203C-7579-4525-906E-BC55268421C1} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {A2B72833-5D70-4C42-AE85-E0319926FB8A} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {4C2AD8AB-8AC0-46C4-80C6-C5577C7255F6} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {DA000953-7532-4DF5-8DB9-8143DF98D999} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} - {FCFE6024-2720-49B4-8257-9DBC6114F0F1} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {A353B17E-A940-4CE8-8BF9-179E24A9041F} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {F21E225B-190B-4DAA-8B0A-05986D231F56} = {DAAE4C74-D06F-4874-A166-33305D2643CE} {3F8B8FC1-9FE4-4788-8991-367113E8D7AD} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} @@ -1077,5 +987,11 @@ Global {9879B5D5-2325-4A81-B4DF-F279FE8FEEB4} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {14ED4476-9F24-4776-8417-EA6927F6C9C9} = {DAAE4C74-D06F-4874-A166-33305D2643CE} {73F095D2-D0BD-4D03-BC17-D7A5EF0C0191} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {364EC3C6-C9DB-45E0-A0F2-1EE61E4B429B} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {AC9BE567-540E-4C70-90C2-AAF021307A80} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {EA34877F-1AC1-42B7-B4E6-15A093F40CAE} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {DAB1252D-577C-4912-98BE-1A812BF83F86} = {DAAE4C74-D06F-4874-A166-33305D2643CE} + {FCFE6024-2720-49B4-8257-9DBC6114F0F1} = {DAAE4C74-D06F-4874-A166-33305D2643CE} EndGlobalSection EndGlobal diff --git a/test/WebSites/CustomRouteWebSite/Controllers/Canada/CustomRoute_ProductsController.cs b/samples/CustomRouteSample.Web/Controllers/Canada/ProductsController.cs similarity index 74% rename from test/WebSites/CustomRouteWebSite/Controllers/Canada/CustomRoute_ProductsController.cs rename to samples/CustomRouteSample.Web/Controllers/Canada/ProductsController.cs index 1be99c526..d77dcb5b2 100644 --- a/test/WebSites/CustomRouteWebSite/Controllers/Canada/CustomRoute_ProductsController.cs +++ b/samples/CustomRouteSample.Web/Controllers/Canada/ProductsController.cs @@ -3,10 +3,10 @@ using Microsoft.AspNet.Mvc; -namespace CustomRouteWebSite.Controllers.Canada +namespace CustomRouteSample.Web.Controllers.Canada { [Locale("en-CA")] - public class CustomRoute_ProductsController : Controller + public class ProductsController : Controller { public string Index() { diff --git a/test/WebSites/CustomRouteWebSite/Controllers/CustomRoute_OrdersControlller.cs b/samples/CustomRouteSample.Web/Controllers/OrdersControlller.cs similarity index 69% rename from test/WebSites/CustomRouteWebSite/Controllers/CustomRoute_OrdersControlller.cs rename to samples/CustomRouteSample.Web/Controllers/OrdersControlller.cs index c6547b032..701becaf3 100644 --- a/test/WebSites/CustomRouteWebSite/Controllers/CustomRoute_OrdersControlller.cs +++ b/samples/CustomRouteSample.Web/Controllers/OrdersControlller.cs @@ -3,11 +3,11 @@ using Microsoft.AspNet.Mvc; -namespace CustomRouteWebSite.Controllers +namespace CustomRouteSample.Web.Controllers { - public class CustomRoute_OrdersControlller : Controller + public class OrdersControlller : Controller { - [HttpGet("CustomRoute_Orders/{id}")] + [HttpGet("Orders/{id}")] public string Index(int id) { return "Hello from " + RouteData.Values["locale"] + "."; diff --git a/test/WebSites/CustomRouteWebSite/Controllers/Spain/CustomRoute_ProductsController.cs b/samples/CustomRouteSample.Web/Controllers/Spain/ProductsController.cs similarity index 74% rename from test/WebSites/CustomRouteWebSite/Controllers/Spain/CustomRoute_ProductsController.cs rename to samples/CustomRouteSample.Web/Controllers/Spain/ProductsController.cs index 25579993f..8c0a2a87c 100644 --- a/test/WebSites/CustomRouteWebSite/Controllers/Spain/CustomRoute_ProductsController.cs +++ b/samples/CustomRouteSample.Web/Controllers/Spain/ProductsController.cs @@ -3,10 +3,10 @@ using Microsoft.AspNet.Mvc; -namespace CustomRouteWebSite.Controllers.Spain +namespace CustomRouteSample.Web.Controllers.Spain { [Locale("es-ES")] - public class CustomRoute_ProductsController : Controller + public class ProductsController : Controller { public string Index() { diff --git a/test/WebSites/CustomRouteWebSite/Controllers/US/CustomRoute_ProductsController.cs b/samples/CustomRouteSample.Web/Controllers/US/ProductsController.cs similarity index 75% rename from test/WebSites/CustomRouteWebSite/Controllers/US/CustomRoute_ProductsController.cs rename to samples/CustomRouteSample.Web/Controllers/US/ProductsController.cs index f17a0bf1e..74e83fa61 100644 --- a/test/WebSites/CustomRouteWebSite/Controllers/US/CustomRoute_ProductsController.cs +++ b/samples/CustomRouteSample.Web/Controllers/US/ProductsController.cs @@ -3,10 +3,10 @@ using Microsoft.AspNet.Mvc; -namespace CustomRouteWebSite.Controllers.US +namespace CustomRouteSample.Web.Controllers.US { [Locale("en-US")] - public class CustomRoute_ProductsController : Controller + public class ProductsController : Controller { public string Index() { diff --git a/test/WebSites/CustomRouteWebSite/CustomRouteWebSite.xproj b/samples/CustomRouteSample.Web/CustomRouteSample.Web.xproj similarity index 81% rename from test/WebSites/CustomRouteWebSite/CustomRouteWebSite.xproj rename to samples/CustomRouteSample.Web/CustomRouteSample.Web.xproj index c678df4be..b18a4a110 100644 --- a/test/WebSites/CustomRouteWebSite/CustomRouteWebSite.xproj +++ b/samples/CustomRouteSample.Web/CustomRouteSample.Web.xproj @@ -7,8 +7,8 @@ 364ec3c6-c9db-45e0-a0f2-1ee61e4b429b - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ 2.0 diff --git a/test/WebSites/CustomRouteWebSite/LocaleAttribute.cs b/samples/CustomRouteSample.Web/LocaleAttribute.cs similarity index 92% rename from test/WebSites/CustomRouteWebSite/LocaleAttribute.cs rename to samples/CustomRouteSample.Web/LocaleAttribute.cs index cca23fcc6..f06529966 100644 --- a/test/WebSites/CustomRouteWebSite/LocaleAttribute.cs +++ b/samples/CustomRouteSample.Web/LocaleAttribute.cs @@ -3,7 +3,7 @@ using Microsoft.AspNet.Mvc.Infrastructure; -namespace CustomRouteWebSite +namespace CustomRouteSample.Web { public class LocaleAttribute : RouteConstraintAttribute { diff --git a/test/WebSites/CustomRouteWebSite/LocalizedRoute.cs b/samples/CustomRouteSample.Web/LocalizedRoute.cs similarity index 97% rename from test/WebSites/CustomRouteWebSite/LocalizedRoute.cs rename to samples/CustomRouteSample.Web/LocalizedRoute.cs index a85da8b8a..992c8f8e0 100644 --- a/test/WebSites/CustomRouteWebSite/LocalizedRoute.cs +++ b/samples/CustomRouteSample.Web/LocalizedRoute.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Http; using Microsoft.AspNet.Routing; -namespace CustomRouteWebSite +namespace CustomRouteSample.Web { public class LocalizedRoute : IRouter { diff --git a/test/WebSites/CustomRouteWebSite/Startup.cs b/samples/CustomRouteSample.Web/Startup.cs similarity index 91% rename from test/WebSites/CustomRouteWebSite/Startup.cs rename to samples/CustomRouteSample.Web/Startup.cs index 5dbfa766e..18d1bd16a 100644 --- a/test/WebSites/CustomRouteWebSite/Startup.cs +++ b/samples/CustomRouteSample.Web/Startup.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Builder; using Microsoft.Extensions.DependencyInjection; -namespace CustomRouteWebSite +namespace CustomRouteSample.Web { public class Startup { @@ -16,8 +16,6 @@ namespace CustomRouteWebSite public void Configure(IApplicationBuilder app) { - app.UseCultureReplacer(); - app.UseMvc(routes => { routes.DefaultHandler = new LocalizedRoute(routes.DefaultHandler); diff --git a/samples/CustomRouteSample.Web/project.json b/samples/CustomRouteSample.Web/project.json new file mode 100644 index 000000000..28e88dae7 --- /dev/null +++ b/samples/CustomRouteSample.Web/project.json @@ -0,0 +1,15 @@ +{ + "commands": { + "web": "Microsoft.AspNet.Server.Kestrel", + "weblistener": "Microsoft.AspNet.Server.WebListener" + }, + "dependencies": { + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } +} diff --git a/test/WebSites/CustomRouteWebSite/readme.md b/samples/CustomRouteSample.Web/readme.md similarity index 58% rename from test/WebSites/CustomRouteWebSite/readme.md rename to samples/CustomRouteSample.Web/readme.md index 0547070e1..857209b1a 100644 --- a/test/WebSites/CustomRouteWebSite/readme.md +++ b/samples/CustomRouteSample.Web/readme.md @@ -1,4 +1,4 @@ -CustomRouteWebSite +CustomRouteSample.Web === -This web site illustrates how a custom route injects route data based on the user. +This web site illustrates how a custom route injects route data based on a "User" header. diff --git a/samples/CustomRouteSample.Web/wwwroot/web.config b/samples/CustomRouteSample.Web/wwwroot/web.config new file mode 100644 index 000000000..8485f6719 --- /dev/null +++ b/samples/CustomRouteSample.Web/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_AdminController.cs b/samples/EmbeddedViewSample.Web/Controllers/AdminController.cs similarity index 73% rename from test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_AdminController.cs rename to samples/EmbeddedViewSample.Web/Controllers/AdminController.cs index 363dd9b70..4c78b0c0c 100644 --- a/test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_AdminController.cs +++ b/samples/EmbeddedViewSample.Web/Controllers/AdminController.cs @@ -3,10 +3,10 @@ using Microsoft.AspNet.Mvc; -namespace RazorEmbeddedViewsWebSite.Controllers +namespace EmbeddedViewSample.Web.Controllers { [Area("Restricted")] - public class RazorEmbeddedViews_AdminController : Controller + public class AdminController : Controller { public IActionResult Login() { diff --git a/test/WebSites/LoggingWebSite/Controllers/HomeController.cs b/samples/EmbeddedViewSample.Web/Controllers/HomeController.cs similarity index 67% rename from test/WebSites/LoggingWebSite/Controllers/HomeController.cs rename to samples/EmbeddedViewSample.Web/Controllers/HomeController.cs index 787cd7892..ba0813008 100644 --- a/test/WebSites/LoggingWebSite/Controllers/HomeController.cs +++ b/samples/EmbeddedViewSample.Web/Controllers/HomeController.cs @@ -3,13 +3,19 @@ using Microsoft.AspNet.Mvc; -namespace LoggingWebSite.Controllers +namespace EmbeddedViewSample.Web { public class HomeController : Controller { + // Interactive home page. public IActionResult Index() { return View(); } + + public IActionResult EchoActionUrl() + { + return View(); + } } } \ No newline at end of file diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/EmbeddedResources/Areas/Restricted/Views/RazorEmbeddedViews_Admin/Login.cshtml b/samples/EmbeddedViewSample.Web/EmbeddedResources/Areas/Restricted/Views/Admin/Login.cshtml similarity index 100% rename from test/WebSites/RazorEmbeddedViewsWebSite/EmbeddedResources/Areas/Restricted/Views/RazorEmbeddedViews_Admin/Login.cshtml rename to samples/EmbeddedViewSample.Web/EmbeddedResources/Areas/Restricted/Views/Admin/Login.cshtml diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/EmbeddedResources/Views/RazorEmbeddedViews_Home/Index.cshtml b/samples/EmbeddedViewSample.Web/EmbeddedResources/Views/Home/EchoActionUrl.cshtml similarity index 100% rename from test/WebSites/RazorEmbeddedViewsWebSite/EmbeddedResources/Views/RazorEmbeddedViews_Home/Index.cshtml rename to samples/EmbeddedViewSample.Web/EmbeddedResources/Views/Home/EchoActionUrl.cshtml diff --git a/samples/EmbeddedViewSample.Web/EmbeddedResources/Views/Home/Index.cshtml b/samples/EmbeddedViewSample.Web/EmbeddedResources/Views/Home/Index.cshtml new file mode 100644 index 000000000..facd4356e --- /dev/null +++ b/samples/EmbeddedViewSample.Web/EmbeddedResources/Views/Home/Index.cshtml @@ -0,0 +1,13 @@ + + Home page + +
    +
  • @Html.ActionLink( + linkText: "Administrator login", + actionName: "Login", + controllerName: "Admin", + routeValues: new { area = "Restricted" })
  • +
  • @Html.ActionLink(linkText: "Echo action", actionName: "EchoActionUrl")
  • +
+ + \ No newline at end of file diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/RazorEmbeddedViewsWebSite.xproj b/samples/EmbeddedViewSample.Web/EmbeddedViewSample.Web.xproj similarity index 81% rename from test/WebSites/RazorEmbeddedViewsWebSite/RazorEmbeddedViewsWebSite.xproj rename to samples/EmbeddedViewSample.Web/EmbeddedViewSample.Web.xproj index 66f61f5f0..e90d83da6 100644 --- a/test/WebSites/RazorEmbeddedViewsWebSite/RazorEmbeddedViewsWebSite.xproj +++ b/samples/EmbeddedViewSample.Web/EmbeddedViewSample.Web.xproj @@ -7,8 +7,8 @@ b18ade62-35de-4a06-8e1d-edd6245f7f4d - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ 2.0 diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/Startup.cs b/samples/EmbeddedViewSample.Web/Startup.cs similarity index 68% rename from test/WebSites/RazorEmbeddedViewsWebSite/Startup.cs rename to samples/EmbeddedViewSample.Web/Startup.cs index cb2174f57..9f6721225 100644 --- a/test/WebSites/RazorEmbeddedViewsWebSite/Startup.cs +++ b/samples/EmbeddedViewSample.Web/Startup.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.FileProviders; using Microsoft.AspNet.Mvc.Razor; using Microsoft.Extensions.DependencyInjection; -namespace RazorEmbeddedViewsWebSite +namespace EmbeddedViewSample.Web { public class Startup { @@ -19,20 +19,22 @@ namespace RazorEmbeddedViewsWebSite services.Configure(options => { - options.FileProvider = new EmbeddedFileProvider(GetType().GetTypeInfo().Assembly, "RazorEmbeddedViewsWebSite.EmbeddedResources"); + // Base namespace matches the resources added to the assembly from the EmbeddedResources folder. + options.FileProvider = new EmbeddedFileProvider( + GetType().GetTypeInfo().Assembly, + baseNamespace: "EmbeddedViewSample.Web.EmbeddedResources"); }); } public void Configure(IApplicationBuilder app) { - app.UseCultureReplacer(); - app.UseMvc(routes => { routes.MapRoute("areaRoute", "{area:exists}/{controller}/{action}"); - routes.MapRoute("default", - "{controller}/{action}/{id?}", - new { controller = "Home", action = "Index" }); + routes.MapRoute( + "default", + "{controller}/{action}/{id?}", + new { controller = "Home", action = "Index" }); }); } } diff --git a/samples/EmbeddedViewSample.Web/project.json b/samples/EmbeddedViewSample.Web/project.json new file mode 100644 index 000000000..51d75a82c --- /dev/null +++ b/samples/EmbeddedViewSample.Web/project.json @@ -0,0 +1,17 @@ +{ + "commands": { + "web": "Microsoft.AspNet.Server.Kestrel", + "weblistener": "Microsoft.AspNet.Server.WebListener" + }, + "resource": "EmbeddedResources/**", + "dependencies": { + "Microsoft.AspNet.FileProviders.Embedded": "1.0.0-*", + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } +} diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/readme.md b/samples/EmbeddedViewSample.Web/readme.md similarity index 76% rename from test/WebSites/RazorEmbeddedViewsWebSite/readme.md rename to samples/EmbeddedViewSample.Web/readme.md index d4e97aff0..49ec6495d 100644 --- a/test/WebSites/RazorEmbeddedViewsWebSite/readme.md +++ b/samples/EmbeddedViewSample.Web/readme.md @@ -1,4 +1,4 @@ -RazorEmbeddedViewsWebSite +EmbeddedViewSample.Web === This web site illustrates use cases for `RazorViewEngineOptions.FileProvider`. diff --git a/samples/EmbeddedViewSample.Web/wwwroot/web.config b/samples/EmbeddedViewSample.Web/wwwroot/web.config new file mode 100644 index 000000000..8485f6719 --- /dev/null +++ b/samples/EmbeddedViewSample.Web/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/WebSites/FormatFilterWebSite/Controllers/FormatFilterController.cs b/samples/FormatFilterSample.Web/Controllers/FormatFilterController.cs similarity index 74% rename from test/WebSites/FormatFilterWebSite/Controllers/FormatFilterController.cs rename to samples/FormatFilterSample.Web/Controllers/FormatFilterController.cs index e1c46443a..2c9a01bb2 100644 --- a/test/WebSites/FormatFilterWebSite/Controllers/FormatFilterController.cs +++ b/samples/FormatFilterSample.Web/Controllers/FormatFilterController.cs @@ -3,17 +3,20 @@ using Microsoft.AspNet.Mvc; -namespace FormatFilterWebSite +namespace FormatFilterSample.Web { [FormatFilter] public class FormatFilterController : Controller - { + { + [Route("[controller]/[action]/{id}.{format?}")] + [Route("[controller]/[action].{format}")] public Product GetProduct(int id = 0) { return new Product() { SampleInt = id }; } [Produces("application/custom", "application/json", "text/json")] + [Route("[controller]/[action]/{id}.{format}")] public Product ProducesMethod(int id) { return new Product() { SampleInt = id }; diff --git a/test/WebSites/FormatFilterWebSite/Controllers/ProducesOverrideClass.cs b/samples/FormatFilterSample.Web/Controllers/ProducesOverrideClass.cs similarity index 69% rename from test/WebSites/FormatFilterWebSite/Controllers/ProducesOverrideClass.cs rename to samples/FormatFilterSample.Web/Controllers/ProducesOverrideClass.cs index f1d397abe..c592c99cc 100644 --- a/test/WebSites/FormatFilterWebSite/Controllers/ProducesOverrideClass.cs +++ b/samples/FormatFilterSample.Web/Controllers/ProducesOverrideClass.cs @@ -3,15 +3,16 @@ using Microsoft.AspNet.Mvc; -namespace FormatFilterWebSite +namespace FormatFilterSample.Web { - [Produces("application/custom_ProducesController")] + [Produces("application/controller")] + [Route("[controller]/[action]")] public class ProducesOverrideController { - [Produces("application/ProducesMethod")] + [Produces("application/custom")] public string ReturnClassName() { return "ProducesOverrideController"; } - } + } } \ No newline at end of file diff --git a/test/WebSites/FormatFilterWebSite/CustomFormatter.cs b/samples/FormatFilterSample.Web/CustomFormatter.cs similarity index 78% rename from test/WebSites/FormatFilterWebSite/CustomFormatter.cs rename to samples/FormatFilterSample.Web/CustomFormatter.cs index 57708c6be..ed915cb37 100644 --- a/test/WebSites/FormatFilterWebSite/CustomFormatter.cs +++ b/samples/FormatFilterSample.Web/CustomFormatter.cs @@ -7,12 +7,10 @@ using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc.Formatters; using Microsoft.Net.Http.Headers; -namespace FormatFilterWebSite +namespace FormatFilterSample.Web { public class CustomFormatter : OutputFormatter { - public string ContentType { get; private set; } - public CustomFormatter(string contentType) { ContentType = contentType; @@ -20,22 +18,29 @@ namespace FormatFilterWebSite SupportedEncodings.Add(Encoding.GetEncoding("utf-8")); } + public string ContentType { get; } + public override bool CanWriteResult(OutputFormatterCanWriteContext context) { if (base.CanWriteResult(context)) { - var actionReturn = context.Object as Product; - if (actionReturn != null) + if (context.Object is Product) + { + return true; + } + + if (context.Object is string) { return true; } } + return false; } public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context) { - var response = context.HttpContext.Response; + var response = context.HttpContext.Response; await response.WriteAsync(context.Object.ToString()); } } diff --git a/test/WebSites/FormatFilterWebSite/FormatFilterWebSite.xproj b/samples/FormatFilterSample.Web/FormatFilterSample.Web.xproj similarity index 81% rename from test/WebSites/FormatFilterWebSite/FormatFilterWebSite.xproj rename to samples/FormatFilterSample.Web/FormatFilterSample.Web.xproj index 2fa473d10..150dd615c 100644 --- a/test/WebSites/FormatFilterWebSite/FormatFilterWebSite.xproj +++ b/samples/FormatFilterSample.Web/FormatFilterSample.Web.xproj @@ -7,8 +7,8 @@ ac9be567-540e-4c70-90c2-aaf021307a80 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ 2.0 diff --git a/samples/FormatFilterSample.Web/Models/Product.cs b/samples/FormatFilterSample.Web/Models/Product.cs new file mode 100644 index 000000000..034e8ea58 --- /dev/null +++ b/samples/FormatFilterSample.Web/Models/Product.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace FormatFilterSample.Web +{ + public class Product + { + public int SampleInt { get; set; } + + public override string ToString() + { + return "SampleInt:" + SampleInt; + } + } +} \ No newline at end of file diff --git a/test/WebSites/FormatFilterWebSite/Startup.cs b/samples/FormatFilterSample.Web/Startup.cs similarity index 64% rename from test/WebSites/FormatFilterWebSite/Startup.cs rename to samples/FormatFilterSample.Web/Startup.cs index f7193d6e8..3699d7293 100644 --- a/test/WebSites/FormatFilterWebSite/Startup.cs +++ b/samples/FormatFilterSample.Web/Startup.cs @@ -3,11 +3,11 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Routing; +using Microsoft.AspNet.Mvc.Formatters; using Microsoft.Extensions.DependencyInjection; using Microsoft.Net.Http.Headers; -namespace FormatFilterWebSite +namespace FormatFilterSample.Web { public class Startup { @@ -21,6 +21,7 @@ namespace FormatFilterWebSite var customFormatter = new CustomFormatter("application/custom"); options.OutputFormatters.Add(customFormatter); + options.OutputFormatters.RemoveType(); options.FormatterMappings.SetMediaTypeMappingForFormat( "custom", @@ -30,18 +31,7 @@ namespace FormatFilterWebSite public void Configure(IApplicationBuilder app) { - app.UseCultureReplacer(); - - app.UseMvc(routes => - { - routes.MapRoute("formatroute", - "{controller}/{action}/{id}.{format?}", - new { controller = "Home", action = "Index" }); - - routes.MapRoute("optionalroute", - "{controller}/{action}.{format?}", - new { controller = "Home", action = "Index" }); - }); + app.UseMvc(); } } } \ No newline at end of file diff --git a/samples/FormatFilterSample.Web/project.json b/samples/FormatFilterSample.Web/project.json new file mode 100644 index 000000000..28e88dae7 --- /dev/null +++ b/samples/FormatFilterSample.Web/project.json @@ -0,0 +1,15 @@ +{ + "commands": { + "web": "Microsoft.AspNet.Server.Kestrel", + "weblistener": "Microsoft.AspNet.Server.WebListener" + }, + "dependencies": { + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } +} diff --git a/samples/FormatFilterSample.Web/readme.md b/samples/FormatFilterSample.Web/readme.md new file mode 100644 index 000000000..4aaf176a2 --- /dev/null +++ b/samples/FormatFilterSample.Web/readme.md @@ -0,0 +1,5 @@ +FormatFilterSample.Web +=== + +This web site illustrates in depth the process of using new feature URL Media header mappings. It demonstrates adding +URL formats and content type mappings and using them. It also shows how routes need to change for this feature to work. diff --git a/samples/FormatFilterSample.Web/wwwroot/web.config b/samples/FormatFilterSample.Web/wwwroot/web.config new file mode 100644 index 000000000..8485f6719 --- /dev/null +++ b/samples/FormatFilterSample.Web/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/WebSites/InlineConstraintsWebSite/Constraints/IsbnDigitScheme10Constraint.cs b/samples/InlineConstraintSample.Web/Constraints/IsbnDigitScheme10Constraint.cs similarity index 97% rename from test/WebSites/InlineConstraintsWebSite/Constraints/IsbnDigitScheme10Constraint.cs rename to samples/InlineConstraintSample.Web/Constraints/IsbnDigitScheme10Constraint.cs index cb8474e61..33a2a8063 100644 --- a/test/WebSites/InlineConstraintsWebSite/Constraints/IsbnDigitScheme10Constraint.cs +++ b/samples/InlineConstraintSample.Web/Constraints/IsbnDigitScheme10Constraint.cs @@ -4,11 +4,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.RegularExpressions; using Microsoft.AspNet.Http; using Microsoft.AspNet.Routing; -namespace InlineConstraintsWebSite.Constraints +namespace InlineConstraintSample.Web.Constraints { public class IsbnDigitScheme10Constraint : IRouteConstraint { diff --git a/test/WebSites/InlineConstraintsWebSite/Constraints/IsbnDigitScheme13Constraint.cs b/samples/InlineConstraintSample.Web/Constraints/IsbnDigitScheme13Constraint.cs similarity index 96% rename from test/WebSites/InlineConstraintsWebSite/Constraints/IsbnDigitScheme13Constraint.cs rename to samples/InlineConstraintSample.Web/Constraints/IsbnDigitScheme13Constraint.cs index 7242770f6..b9761742d 100644 --- a/test/WebSites/InlineConstraintsWebSite/Constraints/IsbnDigitScheme13Constraint.cs +++ b/samples/InlineConstraintSample.Web/Constraints/IsbnDigitScheme13Constraint.cs @@ -7,7 +7,7 @@ using System.Linq; using Microsoft.AspNet.Http; using Microsoft.AspNet.Routing; -namespace InlineConstraintsWebSite.Constraints +namespace InlineConstraintSample.Web.Constraints { public class IsbnDigitScheme13Constraint : IRouteConstraint { diff --git a/test/WebSites/InlineConstraintsWebSite/Controllers/HomeController.cs b/samples/InlineConstraintSample.Web/Controllers/HomeController.cs similarity index 70% rename from test/WebSites/InlineConstraintsWebSite/Controllers/HomeController.cs rename to samples/InlineConstraintSample.Web/Controllers/HomeController.cs index 36520666c..0f7b332da 100644 --- a/test/WebSites/InlineConstraintsWebSite/Controllers/HomeController.cs +++ b/samples/InlineConstraintSample.Web/Controllers/HomeController.cs @@ -3,10 +3,13 @@ using Microsoft.AspNet.Mvc; -namespace InlineConstraints.Controllers +namespace InlineConstraintSample.Web.Controllers { public class HomeController : Controller { + [Route("")] + [Route("[controller]")] + [Route("[controller]/[action]")] public IActionResult Index() { return View(); diff --git a/samples/InlineConstraintSample.Web/Controllers/Isbn10Controller.cs b/samples/InlineConstraintSample.Web/Controllers/Isbn10Controller.cs new file mode 100644 index 000000000..c83f7a87a --- /dev/null +++ b/samples/InlineConstraintSample.Web/Controllers/Isbn10Controller.cs @@ -0,0 +1,16 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNet.Mvc; + +namespace InlineConstraintSample.Web.Controllers +{ + public class Isbn10Controller : Controller + { + [Route("book/[action]/{isbnNumber:IsbnDigitScheme10(true)}")] + public string Index(string isbnNumber) + { + return "10 Digit ISBN Number " + isbnNumber; + } + } +} \ No newline at end of file diff --git a/samples/InlineConstraintSample.Web/Controllers/Isbn13Controller.cs b/samples/InlineConstraintSample.Web/Controllers/Isbn13Controller.cs new file mode 100644 index 000000000..ff3fb8760 --- /dev/null +++ b/samples/InlineConstraintSample.Web/Controllers/Isbn13Controller.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNet.Mvc; + +namespace InlineConstraintSample.Web.Controllers +{ + [Route("book/[action]")] + public class Isbn13Controller : Controller + { + [HttpGet("{isbnNumber:IsbnDigitScheme13}")] + public string Index(string isbnNumber) + { + return "13 Digit ISBN Number " + isbnNumber; + } + } +} \ No newline at end of file diff --git a/test/WebSites/InlineConstraintsWebSite/Controllers/ProductsController.cs b/samples/InlineConstraintSample.Web/Controllers/ProductsController.cs similarity index 94% rename from test/WebSites/InlineConstraintsWebSite/Controllers/ProductsController.cs rename to samples/InlineConstraintSample.Web/Controllers/ProductsController.cs index 0d0135eaf..26aaca719 100644 --- a/test/WebSites/InlineConstraintsWebSite/Controllers/ProductsController.cs +++ b/samples/InlineConstraintSample.Web/Controllers/ProductsController.cs @@ -1,15 +1,15 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNet.Mvc; using System; using System.Collections.Generic; using System.Linq; +using Microsoft.AspNet.Mvc; -namespace InlineConstraintsWebSite.Controllers +namespace InlineConstraintSample.Web.Controllers { [Route("products/[action]")] - public class InlineConstraints_ProductsController : Controller + public class ProductsController : Controller { public IDictionary Index() { @@ -51,7 +51,7 @@ namespace InlineConstraintsWebSite.Controllers { return RouteData.Values; } - + [HttpGet("{manId:int:min(10)?}")] public IDictionary GetProductByManufacturerId(int manId) { diff --git a/test/WebSites/InlineConstraintsWebSite/Controllers/StoreController.cs b/samples/InlineConstraintSample.Web/Controllers/StoreController.cs similarity index 70% rename from test/WebSites/InlineConstraintsWebSite/Controllers/StoreController.cs rename to samples/InlineConstraintSample.Web/Controllers/StoreController.cs index c3b2accff..c64e5352c 100644 --- a/test/WebSites/InlineConstraintsWebSite/Controllers/StoreController.cs +++ b/samples/InlineConstraintSample.Web/Controllers/StoreController.cs @@ -1,19 +1,21 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNet.Mvc; using System; using System.Collections.Generic; +using Microsoft.AspNet.Mvc; -namespace InlineConstraintsWebSite.Controllers +namespace InlineConstraintSample.Web.Controllers { - public class InlineConstraints_StoreController : Controller + public class StoreController : Controller { + [Route("store/[action]/{id:guid?}")] public IDictionary GetStoreById(Guid id) { return RouteData.Values; } + [Route("store/[action]/{location:alpha:minlength(3):maxlength(10)}")] public IDictionary GetStoreByLocation(string location) { return RouteData.Values; diff --git a/test/WebSites/InlineConstraintsWebSite/Controllers/UsersController.cs b/samples/InlineConstraintSample.Web/Controllers/UsersController.cs similarity index 78% rename from test/WebSites/InlineConstraintsWebSite/Controllers/UsersController.cs rename to samples/InlineConstraintSample.Web/Controllers/UsersController.cs index e8eb03246..89d2131ed 100644 --- a/test/WebSites/InlineConstraintsWebSite/Controllers/UsersController.cs +++ b/samples/InlineConstraintSample.Web/Controllers/UsersController.cs @@ -3,10 +3,11 @@ using Microsoft.AspNet.Mvc; -namespace InlineConstraints.Controllers +namespace InlineConstraintSample.Web.Controllers { public class UsersController : Controller { + [Route("constant-prefix/[controller]")] public IActionResult Index() { return Content("Users.Index"); diff --git a/test/WebSites/InlineConstraintsWebSite/InlineConstraintsWebSite.xproj b/samples/InlineConstraintSample.Web/InlineConstraintSample.Web.xproj similarity index 81% rename from test/WebSites/InlineConstraintsWebSite/InlineConstraintsWebSite.xproj rename to samples/InlineConstraintSample.Web/InlineConstraintSample.Web.xproj index 0f547aabf..989088435 100644 --- a/test/WebSites/InlineConstraintsWebSite/InlineConstraintsWebSite.xproj +++ b/samples/InlineConstraintSample.Web/InlineConstraintSample.Web.xproj @@ -7,8 +7,8 @@ ea34877f-1ac1-42b7-b4e6-15a093f40cae - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ 2.0 diff --git a/samples/InlineConstraintSample.Web/Startup.cs b/samples/InlineConstraintSample.Web/Startup.cs new file mode 100644 index 000000000..301c1ee6b --- /dev/null +++ b/samples/InlineConstraintSample.Web/Startup.cs @@ -0,0 +1,50 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using InlineConstraintSample.Web.Constraints; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Localization; +using Microsoft.Extensions.DependencyInjection; + +namespace InlineConstraintSample.Web +{ + public class Startup + { + // Set up application services + public void ConfigureServices(IServiceCollection services) + { + services.ConfigureRouting( + routeOptions => routeOptions.ConstraintMap.Add( + "IsbnDigitScheme10", + typeof(IsbnDigitScheme10Constraint))); + + services.ConfigureRouting( + routeOptions => routeOptions.ConstraintMap.Add( + "IsbnDigitScheme13", + typeof(IsbnDigitScheme10Constraint))); + + // Update an existing constraint from ConstraintMap for test purpose. + services.ConfigureRouting( + routeOptions => + { + if (routeOptions.ConstraintMap.ContainsKey("IsbnDigitScheme13")) + { + routeOptions.ConstraintMap["IsbnDigitScheme13"] = typeof(IsbnDigitScheme13Constraint); + } + }); + + // Add MVC services to the services container + services.AddMvc(); + } + + public void Configure(IApplicationBuilder app) + { + // Ignore ambient and client locale. Use same values as ReplaceCultureAttribute / CultureReplacerMiddleware. + var localizationOptions = new RequestLocalizationOptions(); + localizationOptions.RequestCultureProviders.Clear(); + app.UseRequestLocalization(localizationOptions, new RequestCulture("en-GB", "en-US")); + + app.UseMvc(); + } + } +} diff --git a/test/WebSites/InlineConstraintsWebSite/Views/Home/Index.cshtml b/samples/InlineConstraintSample.Web/Views/Home/Index.cshtml similarity index 100% rename from test/WebSites/InlineConstraintsWebSite/Views/Home/Index.cshtml rename to samples/InlineConstraintSample.Web/Views/Home/Index.cshtml diff --git a/test/WebSites/InlineConstraintsWebSite/Views/Shared/Error.cshtml b/samples/InlineConstraintSample.Web/Views/Shared/Error.cshtml similarity index 100% rename from test/WebSites/InlineConstraintsWebSite/Views/Shared/Error.cshtml rename to samples/InlineConstraintSample.Web/Views/Shared/Error.cshtml diff --git a/test/WebSites/InlineConstraintsWebSite/Views/Shared/_Layout.cshtml b/samples/InlineConstraintSample.Web/Views/Shared/_Layout.cshtml similarity index 100% rename from test/WebSites/InlineConstraintsWebSite/Views/Shared/_Layout.cshtml rename to samples/InlineConstraintSample.Web/Views/Shared/_Layout.cshtml diff --git a/samples/InlineConstraintSample.Web/project.json b/samples/InlineConstraintSample.Web/project.json new file mode 100644 index 000000000..28e88dae7 --- /dev/null +++ b/samples/InlineConstraintSample.Web/project.json @@ -0,0 +1,15 @@ +{ + "commands": { + "web": "Microsoft.AspNet.Server.Kestrel", + "weblistener": "Microsoft.AspNet.Server.WebListener" + }, + "dependencies": { + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } +} diff --git a/test/WebSites/InlineConstraintsWebSite/readme.md b/samples/InlineConstraintSample.Web/readme.md similarity index 63% rename from test/WebSites/InlineConstraintsWebSite/readme.md rename to samples/InlineConstraintSample.Web/readme.md index cd28a097d..4c9f106fa 100644 --- a/test/WebSites/InlineConstraintsWebSite/readme.md +++ b/samples/InlineConstraintSample.Web/readme.md @@ -1,6 +1,6 @@ -InlineConstraintsWebSite +InlineConstraintSample.Web === -This web site illustrates how to use inline route constraints with traditional -routes. The startup class in its configure method reads the routes which are added to configuration by the +This web site illustrates how to use inline route constraints with traditional +routes. The startup class in its configure method reads the routes which are added to configuration by the test methods. diff --git a/samples/InlineConstraintSample.Web/wwwroot/web.config b/samples/InlineConstraintSample.Web/wwwroot/web.config new file mode 100644 index 000000000..8485f6719 --- /dev/null +++ b/samples/InlineConstraintSample.Web/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/WebSites/JsonPatchWebSite/Controllers/JsonPatchController.cs b/samples/JsonPatchSample.Web/Controllers/HomeController.cs similarity index 95% rename from test/WebSites/JsonPatchWebSite/Controllers/JsonPatchController.cs rename to samples/JsonPatchSample.Web/Controllers/HomeController.cs index c2cc1dab9..c63538be2 100644 --- a/test/WebSites/JsonPatchWebSite/Controllers/JsonPatchController.cs +++ b/samples/JsonPatchSample.Web/Controllers/HomeController.cs @@ -2,14 +2,14 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using JsonPatchWebSite.Models; +using JsonPatchSample.Web.Models; using Microsoft.AspNet.JsonPatch; using Microsoft.AspNet.Mvc; -namespace JsonPatchWebSite.Controllers +namespace JsonPatchSample.Web.Controllers { [Route("jsonpatch/[action]")] - public class JsonPatchController : Controller + public class HomeController : Controller { [HttpPatch] public IActionResult JsonPatchWithModelState([FromBody] JsonPatchDocument patchDoc) diff --git a/test/WebSites/JsonPatchWebSite/JsonPatchWebSite.xproj b/samples/JsonPatchSample.Web/JsonPatchSample.Web.xproj similarity index 81% rename from test/WebSites/JsonPatchWebSite/JsonPatchWebSite.xproj rename to samples/JsonPatchSample.Web/JsonPatchSample.Web.xproj index b2e871338..82ef61f86 100644 --- a/test/WebSites/JsonPatchWebSite/JsonPatchWebSite.xproj +++ b/samples/JsonPatchSample.Web/JsonPatchSample.Web.xproj @@ -7,8 +7,8 @@ dab1252d-577c-4912-98be-1a812bf83f86 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ 2.0 diff --git a/test/WebSites/JsonPatchWebSite/Models/Product.cs b/samples/JsonPatchSample.Web/Models/Category.cs similarity index 66% rename from test/WebSites/JsonPatchWebSite/Models/Product.cs rename to samples/JsonPatchSample.Web/Models/Category.cs index 92bdd2e08..ac3a3b3fa 100644 --- a/test/WebSites/JsonPatchWebSite/Models/Product.cs +++ b/samples/JsonPatchSample.Web/Models/Category.cs @@ -3,15 +3,8 @@ using Newtonsoft.Json; -namespace JsonPatchWebSite.Models +namespace JsonPatchSample.Web.Models { - public class Product - { - public string ProductName { get; set; } - - public Category ProductCategory { get; set; } - } - [JsonConverter(typeof(ProductCategoryConverter))] public class Category { diff --git a/test/WebSites/JsonPatchWebSite/Models/Customer.cs b/samples/JsonPatchSample.Web/Models/Customer.cs similarity index 89% rename from test/WebSites/JsonPatchWebSite/Models/Customer.cs rename to samples/JsonPatchSample.Web/Models/Customer.cs index b96b2a12b..a1c830529 100644 --- a/test/WebSites/JsonPatchWebSite/Models/Customer.cs +++ b/samples/JsonPatchSample.Web/Models/Customer.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace JsonPatchWebSite.Models +namespace JsonPatchSample.Web.Models { public class Customer { diff --git a/test/WebSites/JsonPatchWebSite/Models/Order.cs b/samples/JsonPatchSample.Web/Models/Order.cs similarity index 90% rename from test/WebSites/JsonPatchWebSite/Models/Order.cs rename to samples/JsonPatchSample.Web/Models/Order.cs index 57ca1cd6e..d35b35883 100644 --- a/test/WebSites/JsonPatchWebSite/Models/Order.cs +++ b/samples/JsonPatchSample.Web/Models/Order.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; -namespace JsonPatchWebSite.Models +namespace JsonPatchSample.Web.Models { public class Order { diff --git a/test/WebSites/ModelBindingWebSite/Models/ArrayOfPersonWithNoProperties.cs b/samples/JsonPatchSample.Web/Models/Product.cs similarity index 53% rename from test/WebSites/ModelBindingWebSite/Models/ArrayOfPersonWithNoProperties.cs rename to samples/JsonPatchSample.Web/Models/Product.cs index 8e820015f..a3453206b 100644 --- a/test/WebSites/ModelBindingWebSite/Models/ArrayOfPersonWithNoProperties.cs +++ b/samples/JsonPatchSample.Web/Models/Product.cs @@ -1,10 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace ModelBindingWebSite.Models +namespace JsonPatchSample.Web.Models { - public class ArrayOfPersonWithNoProperties + public class Product { - public PersonWithNoProperties[] people { get; set; } + public string ProductName { get; set; } + + public Category ProductCategory { get; set; } } } diff --git a/test/WebSites/JsonPatchWebSite/ProductCategoryConverter.cs b/samples/JsonPatchSample.Web/ProductCategoryConverter.cs similarity index 96% rename from test/WebSites/JsonPatchWebSite/ProductCategoryConverter.cs rename to samples/JsonPatchSample.Web/ProductCategoryConverter.cs index 0e946c424..1135d1433 100644 --- a/test/WebSites/JsonPatchWebSite/ProductCategoryConverter.cs +++ b/samples/JsonPatchSample.Web/ProductCategoryConverter.cs @@ -3,11 +3,11 @@ using System; using System.Reflection; -using JsonPatchWebSite.Models; +using JsonPatchSample.Web.Models; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -namespace JsonPatchWebSite +namespace JsonPatchSample.Web { public class ProductCategoryConverter : JsonConverter { diff --git a/test/WebSites/JsonPatchWebSite/ReplaceOrderTypeConverter.cs b/samples/JsonPatchSample.Web/ReplaceOrderTypeConverter.cs similarity index 96% rename from test/WebSites/JsonPatchWebSite/ReplaceOrderTypeConverter.cs rename to samples/JsonPatchSample.Web/ReplaceOrderTypeConverter.cs index 01dd1f09a..ea040b7d3 100644 --- a/test/WebSites/JsonPatchWebSite/ReplaceOrderTypeConverter.cs +++ b/samples/JsonPatchSample.Web/ReplaceOrderTypeConverter.cs @@ -4,7 +4,7 @@ using System; using Newtonsoft.Json; -namespace JsonPatchWebSite +namespace JsonPatchSample.Web { public class ReplaceOrderTypeConverter : JsonConverter { diff --git a/test/WebSites/JsonPatchWebSite/Startup.cs b/samples/JsonPatchSample.Web/Startup.cs similarity index 90% rename from test/WebSites/JsonPatchWebSite/Startup.cs rename to samples/JsonPatchSample.Web/Startup.cs index 6a0f85d1b..069e6f5d2 100644 --- a/test/WebSites/JsonPatchWebSite/Startup.cs +++ b/samples/JsonPatchSample.Web/Startup.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Builder; using Microsoft.Extensions.DependencyInjection; -namespace JsonPatchWebSite +namespace JsonPatchSample.Web { public class Startup { @@ -17,8 +17,6 @@ namespace JsonPatchWebSite public void Configure(IApplicationBuilder app) { - app.UseCultureReplacer(); - // Add MVC to the request pipeline app.UseMvc(); } diff --git a/samples/JsonPatchSample.Web/project.json b/samples/JsonPatchSample.Web/project.json new file mode 100644 index 000000000..39e5b21da --- /dev/null +++ b/samples/JsonPatchSample.Web/project.json @@ -0,0 +1,15 @@ +{ + "commands": { + "web": "Microsoft.AspNet.Server.Kestrel", + "weblistener": "Microsoft.AspNet.Server.WebListener" + }, + "dependencies": { + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } +} diff --git a/test/WebSites/JsonPatchWebSite/readme.md b/samples/JsonPatchSample.Web/readme.md similarity index 79% rename from test/WebSites/JsonPatchWebSite/readme.md rename to samples/JsonPatchSample.Web/readme.md index 970d684af..0d37c5b53 100644 --- a/test/WebSites/JsonPatchWebSite/readme.md +++ b/samples/JsonPatchSample.Web/readme.md @@ -1,4 +1,4 @@ -JsonPatchWebSite +JsonPatchSample.Web === This web site illustrates how to use JSON Patch operation on an object. diff --git a/samples/JsonPatchSample.Web/wwwroot/web.config b/samples/JsonPatchSample.Web/wwwroot/web.config new file mode 100644 index 000000000..8485f6719 --- /dev/null +++ b/samples/JsonPatchSample.Web/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/WebSites/LocalizationWebSite/Controllers/HomeController.cs b/samples/LocalizationSample.Web/Controllers/HomeController.cs similarity index 92% rename from test/WebSites/LocalizationWebSite/Controllers/HomeController.cs rename to samples/LocalizationSample.Web/Controllers/HomeController.cs index bcb872445..2e43cd241 100644 --- a/test/WebSites/LocalizationWebSite/Controllers/HomeController.cs +++ b/samples/LocalizationSample.Web/Controllers/HomeController.cs @@ -1,11 +1,11 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using LocalizationWebSite.Models; +using LocalizationSample.Web.Models; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Localization; -namespace LocalizationWebSite.Controllers +namespace LocalizationSample.Web.Controllers { public class HomeController : Controller { diff --git a/test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj b/samples/LocalizationSample.Web/LocalizationSample.Web.xproj similarity index 81% rename from test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj rename to samples/LocalizationSample.Web/LocalizationSample.Web.xproj index ed9391e93..96e4f2456 100644 --- a/test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj +++ b/samples/LocalizationSample.Web/LocalizationSample.Web.xproj @@ -7,8 +7,8 @@ fcfe6024-2720-49b4-8257-9dbc6114f0f1 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ 2.0 diff --git a/samples/LocalizationSample.Web/Models/Product.cs b/samples/LocalizationSample.Web/Models/Product.cs new file mode 100644 index 000000000..49217992b --- /dev/null +++ b/samples/LocalizationSample.Web/Models/Product.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.ComponentModel.DataAnnotations; + +namespace LocalizationSample.Web.Models +{ + public class Product + { + [Required(ErrorMessage = "ProductName")] + public string ProductName { get; set; } + } +} diff --git a/test/WebSites/LocalizationWebSite/Models/User.cs b/samples/LocalizationSample.Web/Models/User.cs similarity index 69% rename from test/WebSites/LocalizationWebSite/Models/User.cs rename to samples/LocalizationSample.Web/Models/User.cs index 632be4255..93c64408a 100644 --- a/test/WebSites/LocalizationWebSite/Models/User.cs +++ b/samples/LocalizationSample.Web/Models/User.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; -namespace LocalizationWebSite.Models +namespace LocalizationSample.Web.Models { public class User { @@ -12,10 +12,4 @@ namespace LocalizationWebSite.Models public Product Product { get; set; } } - - public class Product - { - [Required(ErrorMessage = "ProductName")] - public string ProductName { get; set; } - } } diff --git a/test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Controllers.HomeController.fr.resx b/samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Controllers.HomeController.fr.resx similarity index 100% rename from test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Controllers.HomeController.fr.resx rename to samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Controllers.HomeController.fr.resx diff --git a/test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.Product.fr.resx b/samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Models.Product.fr.resx similarity index 100% rename from test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.Product.fr.resx rename to samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Models.Product.fr.resx diff --git a/test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.User.fr.resx b/samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Models.User.fr.resx similarity index 100% rename from test/WebSites/LocalizationWebSite/Resources/LocalizationWebSite.Models.User.fr.resx rename to samples/LocalizationSample.Web/Resources/LocalizationSample.Web.Models.User.fr.resx diff --git a/test/WebSites/LocalizationWebSite/Resources/Views.Home.Locpage.cshtml.en-GB.resx b/samples/LocalizationSample.Web/Resources/Views.Home.Locpage.cshtml.en-GB.resx similarity index 100% rename from test/WebSites/LocalizationWebSite/Resources/Views.Home.Locpage.cshtml.en-GB.resx rename to samples/LocalizationSample.Web/Resources/Views.Home.Locpage.cshtml.en-GB.resx diff --git a/test/WebSites/LocalizationWebSite/Resources/Views.Home.Locpage.cshtml.fr.resx b/samples/LocalizationSample.Web/Resources/Views.Home.Locpage.cshtml.fr.resx similarity index 100% rename from test/WebSites/LocalizationWebSite/Resources/Views.Home.Locpage.cshtml.fr.resx rename to samples/LocalizationSample.Web/Resources/Views.Home.Locpage.cshtml.fr.resx diff --git a/test/WebSites/LocalizationWebSite/Resources/Views.Shared._LocalizationLayout.cshtml.fr.resx b/samples/LocalizationSample.Web/Resources/Views.Shared._LocalizationLayout.cshtml.fr.resx similarity index 100% rename from test/WebSites/LocalizationWebSite/Resources/Views.Shared._LocalizationLayout.cshtml.fr.resx rename to samples/LocalizationSample.Web/Resources/Views.Shared._LocalizationLayout.cshtml.fr.resx diff --git a/test/WebSites/LocalizationWebSite/Startup.cs b/samples/LocalizationSample.Web/Startup.cs similarity index 94% rename from test/WebSites/LocalizationWebSite/Startup.cs rename to samples/LocalizationSample.Web/Startup.cs index b1094b611..46de9a60d 100644 --- a/test/WebSites/LocalizationWebSite/Startup.cs +++ b/samples/LocalizationSample.Web/Startup.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Localization; using Microsoft.Extensions.DependencyInjection; -namespace LocalizationWebSite +namespace LocalizationSample.Web { public class Startup { @@ -21,8 +21,6 @@ namespace LocalizationWebSite public void Configure(IApplicationBuilder app) { - app.UseCultureReplacer(); - var options = new RequestLocalizationOptions { SupportedCultures = new List diff --git a/test/WebSites/LocalizationWebSite/Views/Home/GetInvalidUser.cshtml b/samples/LocalizationSample.Web/Views/Home/GetInvalidUser.cshtml similarity index 76% rename from test/WebSites/LocalizationWebSite/Views/Home/GetInvalidUser.cshtml rename to samples/LocalizationSample.Web/Views/Home/GetInvalidUser.cshtml index 08fb71fc8..5269a7aae 100644 --- a/test/WebSites/LocalizationWebSite/Views/Home/GetInvalidUser.cshtml +++ b/samples/LocalizationSample.Web/Views/Home/GetInvalidUser.cshtml @@ -1,4 +1,4 @@ -@model LocalizationWebSite.Models.User +@model LocalizationSample.Web.Models.User @Html.ValidationMessage("Name") @Html.ValidationMessage("Product.ProductName") diff --git a/test/WebSites/LocalizationWebSite/Views/Home/Index.cshtml b/samples/LocalizationSample.Web/Views/Home/Index.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Home/Index.cshtml rename to samples/LocalizationSample.Web/Views/Home/Index.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Home/Index.en-GB.cshtml b/samples/LocalizationSample.Web/Views/Home/Index.en-GB.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Home/Index.en-GB.cshtml rename to samples/LocalizationSample.Web/Views/Home/Index.en-GB.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Home/Index.fr.cshtml b/samples/LocalizationSample.Web/Views/Home/Index.fr.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Home/Index.fr.cshtml rename to samples/LocalizationSample.Web/Views/Home/Index.fr.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Home/Locpage.cshtml b/samples/LocalizationSample.Web/Views/Home/Locpage.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Home/Locpage.cshtml rename to samples/LocalizationSample.Web/Views/Home/Locpage.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Home/_MyPartial.cshtml b/samples/LocalizationSample.Web/Views/Home/_MyPartial.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Home/_MyPartial.cshtml rename to samples/LocalizationSample.Web/Views/Home/_MyPartial.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Home/_Partial.cshtml b/samples/LocalizationSample.Web/Views/Home/_Partial.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Home/_Partial.cshtml rename to samples/LocalizationSample.Web/Views/Home/_Partial.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Home/_Partial.fr.cshtml b/samples/LocalizationSample.Web/Views/Home/_Partial.fr.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Home/_Partial.fr.cshtml rename to samples/LocalizationSample.Web/Views/Home/_Partial.fr.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Shared/_LocalizationLayout.cshtml b/samples/LocalizationSample.Web/Views/Shared/_LocalizationLayout.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Shared/_LocalizationLayout.cshtml rename to samples/LocalizationSample.Web/Views/Shared/_LocalizationLayout.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Shared/_MyLayout.cshtml b/samples/LocalizationSample.Web/Views/Shared/_MyLayout.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Shared/_MyLayout.cshtml rename to samples/LocalizationSample.Web/Views/Shared/_MyLayout.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Shared/_MyLayout.fr.cshtml b/samples/LocalizationSample.Web/Views/Shared/_MyLayout.fr.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Shared/_MyLayout.fr.cshtml rename to samples/LocalizationSample.Web/Views/Shared/_MyLayout.fr.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/Shared/_MyPartial.en-GB.cshtml b/samples/LocalizationSample.Web/Views/Shared/_MyPartial.en-GB.cshtml similarity index 100% rename from test/WebSites/LocalizationWebSite/Views/Shared/_MyPartial.en-GB.cshtml rename to samples/LocalizationSample.Web/Views/Shared/_MyPartial.en-GB.cshtml diff --git a/test/WebSites/LocalizationWebSite/Views/_ViewImports.cshtml b/samples/LocalizationSample.Web/Views/_ViewImports.cshtml similarity index 57% rename from test/WebSites/LocalizationWebSite/Views/_ViewImports.cshtml rename to samples/LocalizationSample.Web/Views/_ViewImports.cshtml index b3baa19d9..ddcf2cbe8 100644 --- a/test/WebSites/LocalizationWebSite/Views/_ViewImports.cshtml +++ b/samples/LocalizationSample.Web/Views/_ViewImports.cshtml @@ -1,5 +1,5 @@ -@using LocalizationWebSite -@using Microsoft.Extensions.Localization +@using LocalizationSample.Web @using Microsoft.AspNet.Mvc.Localization +@using Microsoft.Extensions.Localization @inject IViewLocalizer LocString \ No newline at end of file diff --git a/samples/LocalizationSample.Web/project.json b/samples/LocalizationSample.Web/project.json new file mode 100644 index 000000000..39e5b21da --- /dev/null +++ b/samples/LocalizationSample.Web/project.json @@ -0,0 +1,15 @@ +{ + "commands": { + "web": "Microsoft.AspNet.Server.Kestrel", + "weblistener": "Microsoft.AspNet.Server.WebListener" + }, + "dependencies": { + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } +} diff --git a/samples/LocalizationSample.Web/readme.md b/samples/LocalizationSample.Web/readme.md new file mode 100644 index 000000000..ffb8f0e4a --- /dev/null +++ b/samples/LocalizationSample.Web/readme.md @@ -0,0 +1,4 @@ +LocalizationSample.Web +=== + +This web site illustrates use cases for MVC localization. diff --git a/samples/LocalizationSample.Web/wwwroot/web.config b/samples/LocalizationSample.Web/wwwroot/web.config new file mode 100644 index 000000000..8485f6719 --- /dev/null +++ b/samples/LocalizationSample.Web/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ActionResultTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ActionResultTests.cs deleted file mode 100644 index 336e4bd74..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ActionResultTests.cs +++ /dev/null @@ -1,315 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ActionResultTests : IClassFixture> - { - public ActionResultTests(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task BadRequestResult_CanBeReturned() - { - // Arrange - var input = "{\"SampleInt\":10}"; - - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetBadResult"); - - request.Content = new StringContent(input, Encoding.UTF8, "application/json"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - Assert.Equal("", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CreatedResult_SetsRelativePathInLocationHeader() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetCreatedRelative"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - Assert.Equal("1", response.Headers.Location.OriginalString); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CreatedResult_SetsAbsolutePathInLocationHeader() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetCreatedAbsolute"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - Assert.Equal("/ActionResultsVerification/GetDummy/1", response.Headers.Location.OriginalString); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CreatedResult_SetsQualifiedPathInLocationHeader() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetCreatedQualified"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - Assert.Equal( - "http://localhost/ActionResultsVerification/GetDummy/1", - response.Headers.Location.OriginalString); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CreatedResult_SetsUriInLocationHeader() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetCreatedUri"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - Assert.Equal("/ActionResultsVerification/GetDummy/1", response.Headers.Location.OriginalString); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CreatedAtActionResult_GeneratesUri_WithActionAndController() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetCreatedAtAction"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - Assert.Equal("http://localhost/ActionResultsVerification/GetDummy/1", response.Headers.Location.OriginalString); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CreatedAtRouteResult_GeneratesUri_WithRouteValues() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetCreatedAtRoute"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - Assert.Equal("http://localhost/ActionResultsVerification/GetDummy/1", response.Headers.Location.OriginalString); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CreatedAtRouteResult_GeneratesUri_WithRouteName() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetCreatedAtRouteWithRouteName"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - Assert.Equal("http://localhost/foo/ActionResultsVerification/GetDummy/1", response.Headers.Location.OriginalString); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task SerializableError_CanSerializeNormalObjects() - { - // Arrange - var input = "" + - "" + - "2foo"; - var request = new HttpRequestMessage(HttpMethod.Post, "Home/GetCustomErrorObject"); - request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - request.Content = new StringContent(input, Encoding.UTF8, "application/xml"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - Assert.Equal("[\"Something went wrong with the model.\"]", - await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ContentResult_WritesContent_SetsDefaultContentTypeAndEncoding() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetContentResult"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("content", await response.Content.ReadAsStringAsync()); - Assert.Equal("text/plain", response.Content.Headers.ContentType.MediaType); - Assert.Equal("utf-8", response.Content.Headers.ContentType.CharSet); - } - - [Fact] - public async Task ContentResult_WritesContent_SetsContentType_UsesDefaultEncoding_AndNoCharset() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetContentResultWithContentType"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("application/json", response.Content.Headers.ContentType.MediaType); - Assert.Equal("content", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ContentResult_WritesContent_SetsContentTypeAndEncoding() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetContentResultWithContentTypeAndEncoding"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("application/json", response.Content.Headers.ContentType.MediaType); - Assert.Equal("us-ascii", response.Content.Headers.ContentType.CharSet); - Assert.Equal("content", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ObjectResult_WithStatusCodeAndNoContent_SetsSameStatusCode() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Get, - "ActionResultsVerification/GetObjectResultWithNoContent"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.Created, response.StatusCode); - } - - [Fact] - public async Task HttpNotFoundObjectResult_NoResponseContent() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Get, - "ActionResultsVerification/GetNotFoundObjectResult"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); - Assert.Equal("", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task HttpNotFoundObjectResult_WithResponseContent() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "ActionResultsVerification/GetNotFoundObjectResultWithContent"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); - Assert.Equal("{\"SampleInt\":10,\"SampleString\":\"Foo\"}", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task HttpNotFoundObjectResult_WithDisposableObject() - { - // Arrange - var nameValueCollection = new List> - { - new KeyValuePair("guid", Guid.NewGuid().ToString()), - }; - - // Act - var response1 = await Client.PostAsync( - "/ActionResultsVerification/GetDisposeCalled", - new FormUrlEncodedContent(nameValueCollection)); - - await Client.PostAsync( - "/ActionResultsVerification/GetNotFoundObjectResultWithDisposableObject", - new FormUrlEncodedContent(nameValueCollection)); - - var response2 = await Client.PostAsync( - "/ActionResultsVerification/GetDisposeCalled", - new FormUrlEncodedContent(nameValueCollection)); - - // Assert - var isDisposed = Convert.ToBoolean(await response1.Content.ReadAsStringAsync()); - Assert.False(isDisposed); - - isDisposed = Convert.ToBoolean(await response2.Content.ReadAsStringAsync()); - Assert.True(isDisposed); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ActivatorTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ActivatorTests.cs deleted file mode 100644 index afde2fe3b..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ActivatorTests.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Net.Http; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ActivatorTests : IClassFixture> - { - public ActivatorTests(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task ControllerThatCannotBeActivated_ThrowsWhenAttemptedToBeInvoked() - { - // Arrange - var expectedMessage = - "Unable to resolve service for type 'ActivatorWebSite.CannotBeActivatedController+FakeType' while " + - "attempting to activate 'ActivatorWebSite.CannotBeActivatedController'."; - - // Act & Assert - var response = await Client.GetAsync("CannotBeActivated/Index"); - - var exception = response.GetServerException(); - Assert.Equal(typeof(InvalidOperationException).FullName, exception.ExceptionType); - Assert.Equal(expectedMessage, exception.ExceptionMessage); - } - - [Fact] - public async Task PropertiesForPocoControllersAreInitialized() - { - // Arrange - var expected = "4|some-text"; - - // Act - var response = await Client.GetAsync("Plain?foo=some-text"); - - // Assert - var headerValue = Assert.Single(response.Headers.GetValues("X-Fake-Header")); - Assert.Equal("Fake-Value", headerValue); - var body = await response.Content.ReadAsStringAsync(); - Assert.Equal(expected, body); - } - - [Fact] - public async Task PropertiesForTypesDerivingFromControllerAreInitialized() - { - // Arrange - var expected = "Hello world"; - - // Act - var body = await Client.GetStringAsync("Regular"); - - // Assert - Assert.Equal(expected, body); - } - - [Fact] - public async Task ViewActivator_ActivatesDefaultInjectedProperties() - { - // Arrange - var expected = @" world! /View/ConsumeServicesFromBaseType"; - - // Act - var body = await Client.GetStringAsync("View/ConsumeDefaultProperties"); - - // Assert - Assert.Equal(expected, body.Trim()); - } - - [Fact] - public async Task ViewActivator_ActivatesAndContextualizesInjectedServices() - { - // Arrange - var expected = "4 test-value"; - - // Act - var body = await Client.GetStringAsync("View/ConsumeInjectedService?test=test-value"); - - // Assert - Assert.Equal(expected, body.Trim()); - } - - [Fact] - public async Task ViewActivator_ActivatesServicesFromBaseType() - { - // Arrange - var expected = @"/content/scripts/test.js"; - - // Act - var body = await Client.GetStringAsync("View/ConsumeServicesFromBaseType"); - - // Assert - Assert.Equal(expected, body.Trim()); - } - - [Fact] - public async Task ViewComponentActivator_Activates() - { - // Arrange - var expected = @"Random Number:4"; - - // Act - var body = await Client.GetStringAsync("View/ConsumeViewComponent"); - - // Assert - Assert.Equal(expected, body.Trim()); - } - - - [Fact] - public async Task ViewComponentThatCannotBeActivated_ThrowsWhenAttemptedToBeInvoked() - { - // Arrange - var expectedMessage = - "Unable to resolve service for type 'ActivatorWebSite.CannotBeActivatedComponent+FakeType' " + - "while attempting to activate 'ActivatorWebSite.CannotBeActivatedComponent'."; - - // Act & Assert - var response = await Client.GetAsync("View/ConsumeCannotBeActivatedComponent"); - - var exception = response.GetServerException(); - Assert.Equal(typeof(InvalidOperationException).FullName, exception.ExceptionType); - Assert.Equal(expectedMessage, exception.ExceptionMessage); - } - - [Fact] - public async Task TagHelperActivation_ConstructorInjection_RendersProperly() - { - // Arrange - var expected = "

Activation Test

" + - Environment.NewLine + - "
FakeFakeFake
" + - Environment.NewLine + - "" + - "" + - "" + - Environment.NewLine + - "
Footer from activated ViewData
" + - ""; - - // Act - var body = await Client.GetStringAsync("View/UseTagHelper"); - - // Assert - Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ApplicationModelTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ApplicationModelTest.cs index 3f9b7c5b4..7831666a2 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ApplicationModelTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/ApplicationModelTest.cs @@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public async Task ApplicationModelExtensions_AddsConventionToAllControllers() { // Arrange & Act - var response = await Client.GetAsync("http://localhost/Lisence/GetLisence"); + var response = await Client.GetAsync("http://localhost/License/GetLicense"); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs deleted file mode 100644 index c5b07d56d..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ControllerDiscoveryConventionTests : - IClassFixture>, - IClassFixture> - { - public ControllerDiscoveryConventionTests( - MvcTestFixture fixture, - FilteredDefaultAssemblyProviderFixture filteredFixture) - { - Client = fixture.Client; - FilteredClient = filteredFixture.Client; - } - - public HttpClient Client { get; } - - public HttpClient FilteredClient { get; } - - [Fact] - public async Task AbstractControllers_AreSkipped() - { - // Arrange & Act - var response = await Client.GetAsync("Abstract/GetValue"); - - // Assert - Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); - } - - [Fact] - public async Task TypesDerivingFromControllerBaseTypesThatDoNotReferenceMvc_AreSkipped() - { - // Arrange & Act - var response = await Client.GetAsync("SqlTransactionManager/GetValue"); - - // Assert - Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); - } - - [Fact] - public async Task TypesMarkedWithNonController_AreSkipped() - { - // Arrange & Act - var response = await Client.GetAsync("NonController/GetValue"); - - // Assert - Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); - } - - [Fact] - public async Task PocoTypesWithControllerSuffix_AreDiscovered() - { - // Arrange & Act - var response = await Client.GetAsync("Poco/GetValue"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("PocoController", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task TypesDerivingFromTypesWithControllerSuffix_AreDiscovered() - { - // Arrange & Act - var response = await Client.GetAsync("ChildOfAbstract/GetValue"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("AbstractController", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task TypesDerivingFromApiController_AreDiscovered() - { - // Arrange & Act - var response = await FilteredClient.GetAsync("PersonApi/GetValue"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("PersonApi", await response.Content.ReadAsStringAsync()); - } - } -} diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/CustomRouteTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/CustomRouteSampleTest.cs similarity index 87% rename from test/Microsoft.AspNet.Mvc.FunctionalTests/CustomRouteTest.cs rename to test/Microsoft.AspNet.Mvc.FunctionalTests/CustomRouteSampleTest.cs index cacb941b9..e62c70c57 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/CustomRouteTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/CustomRouteSampleTest.cs @@ -8,9 +8,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class CustomRouteTest : IClassFixture> + public class CustomRouteSampleTest : IClassFixture> { - public CustomRouteTest(MvcTestFixture fixture) + public CustomRouteSampleTest(MvcTestFixture fixture) { Client = fixture.Client; } @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public async Task RouteToLocale_ConventionalRoute_BasedOnUser(string user, string expected) { // Arrange - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/CustomRoute_Products/Index"); + var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Products/Index"); request.Headers.Add("User", user); // Act @@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public async Task RouteWithAttributeRoute_IncludesLocale_BasedOnUser(string user, string expected) { // Arrange - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/CustomRoute_Orders/5"); + var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Orders/5"); request.Headers.Add("User", user); // Act diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/RazorFileSystemCaseSensitivityTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/EmbeddedViewSampleTest.cs similarity index 53% rename from test/Microsoft.AspNet.Mvc.FunctionalTests/RazorFileSystemCaseSensitivityTest.cs rename to test/Microsoft.AspNet.Mvc.FunctionalTests/EmbeddedViewSampleTest.cs index 940062865..1a54b6456 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/RazorFileSystemCaseSensitivityTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/EmbeddedViewSampleTest.cs @@ -7,11 +7,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - // The EmbeddedFileSystem used by RazorEmbeddedViewsWebSite performs case sensitive lookups for files. - // These tests verify that we correctly normalize route values when constructing view lookup paths. - public class RazorFileSystemCaseSensitivityTest : IClassFixture> + public class EmbeddedViewSampleTest : IClassFixture> { - public RazorFileSystemCaseSensitivityTest(MvcTestFixture fixture) + public EmbeddedViewSampleTest(MvcTestFixture fixture) { Client = fixture.Client; } @@ -19,13 +17,27 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public HttpClient Client { get; } [Fact] - public async Task RazorViewEngine_NormalizesActionName_WhenLookingUpViewPaths() + public async Task RazorViewEngine_UsesFileProviderOnViewEngineOptionsToLocateViews() { // Arrange - var expectedMessage = "Hello test-user, this is /RazorEmbeddedViews_Home"; + var expectedMessage = "Hello test-user, this is /Home/EchoActionUrl"; // Act - var response = await Client.GetStringAsync("http://localhost/RazorEmbeddedViews_Home/index?User=test-user"); + var response = await Client.GetStringAsync("http://localhost/Home/EchoActionUrl?User=test-user"); + + // Assert + Assert.Equal(expectedMessage, response); + } + + [Fact] + public async Task RazorViewEngine_UsesFileProviderOnViewEngineOptionsToLocateAreaViews() + { + // Arrange + var expectedMessage = "Hello admin-user, this is /Restricted/Admin/Login"; + var target = "http://localhost/Restricted/Admin/Login?AdminUser=admin-user"; + + // Act + var response = await Client.GetStringAsync(target); // Assert Assert.Equal(expectedMessage, response); @@ -35,10 +47,10 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public async Task RazorViewEngine_NormalizesControllerRouteValue_WhenLookingUpViewPaths() { // Arrange - var expectedMessage = "Hello test-user, this is /razorembeddedviews_home"; + var expectedMessage = "Hello test-user, this is /home/echoactionurl"; // Act - var response = await Client.GetStringAsync("http://localhost/razorembeddedviews_home?User=test-user"); + var response = await Client.GetStringAsync("http://localhost/home/echoactionurl?User=test-user"); // Assert Assert.Equal(expectedMessage, response); @@ -48,8 +60,8 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public async Task RazorViewEngine_NormalizesAreaRouteValue_WhenLookupViewPaths() { // Arrange - var expectedMessage = "Hello admin-user, this is /restricted/razorembeddedviews_admin/login"; - var target = "http://localhost/restricted/razorembeddedviews_admin/login?AdminUser=admin-user"; + var expectedMessage = "Hello admin-user, this is /restricted/admin/login"; + var target = "http://localhost/restricted/admin/login?AdminUser=admin-user"; // Act var response = await Client.GetStringAsync(target); diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/FilteredDefaultAssemblyProviderFixtureOfT.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/FilteredDefaultAssemblyProviderFixtureOfT.cs deleted file mode 100644 index d4ac0cb6e..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/FilteredDefaultAssemblyProviderFixtureOfT.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNet.Mvc.Infrastructure; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.PlatformAbstractions; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class FilteredDefaultAssemblyProviderFixture : MvcTestFixture - where TStartup : new() - { - protected override void AddAdditionalServices(IServiceCollection services) - { - // MvcTestFixture normally replaces the DefaultAssemblyProvider with an IAssemblyProvider - // implementation that limits the set of candidate assemblies to the executing application. Switch it back - // to using a filtered default assembly provider. - services.AddTransient(); - } - - private class FilteredDefaultAssemblyProvider : DefaultAssemblyProvider - { - public FilteredDefaultAssemblyProvider(ILibraryManager libraryManager) - : base(libraryManager) - { - } - - protected override IEnumerable GetCandidateLibraries() - { - var libraries = base.GetCandidateLibraries(); - - // Filter out other WebSite projects - return libraries.Where(library => !library.Name.Contains("WebSite") || - library.Name.Equals(nameof(ControllerDiscoveryConventionsWebSite), StringComparison.Ordinal)); - } - } - } -} diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/FormatFilterTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/FormatFilterSampleTest.cs similarity index 93% rename from test/Microsoft.AspNet.Mvc.FunctionalTests/FormatFilterTest.cs rename to test/Microsoft.AspNet.Mvc.FunctionalTests/FormatFilterSampleTest.cs index e9d166e03..6472cc4ca 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/FormatFilterTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/FormatFilterSampleTest.cs @@ -8,9 +8,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class FormatFilterTest : IClassFixture> + public class FormatFilterSampleTest : IClassFixture> { - public FormatFilterTest(MvcTestFixture fixture) + public FormatFilterSampleTest(MvcTestFixture fixture) { Client = fixture.Client; } @@ -112,6 +112,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(@"ProducesOverrideController", await response.Content.ReadAsStringAsync()); + Assert.Equal("application/custom", response.Content.Headers.ContentType.MediaType); } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/InlineConstraintTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/InlineConstraintSampleTest.cs similarity index 85% rename from test/Microsoft.AspNet.Mvc.FunctionalTests/InlineConstraintTests.cs rename to test/Microsoft.AspNet.Mvc.FunctionalTests/InlineConstraintSampleTest.cs index 69cd67f78..d9db7ae22 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/InlineConstraintTests.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/InlineConstraintSampleTest.cs @@ -11,9 +11,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class InlineConstraintTests : IClassFixture> + public class InlineConstraintSampleTest : IClassFixture> { - public InlineConstraintTests(MvcTestFixture fixture) + public InlineConstraintSampleTest(MvcTestFixture fixture) { Client = fixture.Client; } @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public async Task RoutingToANonExistantArea_WithExistConstraint_RoutesToCorrectAction() { // Arrange & Act - var response = await Client.GetAsync("http://localhost/area-exists/Users"); + var response = await Client.GetAsync("http://localhost/constant-prefix/Users"); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -32,24 +32,6 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal("Users.Index", returnValue); } - [Fact] - public async Task RoutingToANonExistantArea_WithoutExistConstraint_RoutesToIncorrectAction() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/area-withoutexists/Users"); - - // Assert - var exception = response.GetServerException(); - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal( - "The view 'Index' was not found." + - " The following locations were searched:" + PlatformNormalizer.GetNewLinesAsUnderscores(1) + - "/Areas/Users/Views/Home/Index.cshtml" + PlatformNormalizer.GetNewLinesAsUnderscores(1) + - "/Areas/Users/Views/Shared/Index.cshtml" + PlatformNormalizer.GetNewLinesAsUnderscores(1) + - "/Views/Shared/Index.cshtml", - exception.ExceptionMessage); - } - [Fact] public async Task GetProductById_IntConstraintForOptionalId_IdPresent() { @@ -61,7 +43,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests var result = await GetResponseValues(response); Assert.Equal(result["id"], "5"); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductById"); } @@ -74,7 +56,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductById"); } @@ -98,7 +80,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); Assert.Equal(result["name"], "asdf"); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByName"); } @@ -134,7 +116,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests var result = await GetResponseValues(response); Assert.Equal(result["dateTime"], new DateTime(2014, 10, 11, 13, 45, 30)); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByManufacturingDate"); } @@ -148,7 +130,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); Assert.Equal(result["name"], "Sports"); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByCategoryName"); } @@ -172,7 +154,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByCategoryName"); } @@ -186,7 +168,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); Assert.Equal(result["catId"], "40"); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByCategoryId"); } @@ -220,7 +202,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); Assert.Equal(result["price"], "4023.23423"); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByPrice"); } @@ -233,7 +215,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByPrice"); } @@ -247,7 +229,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); Assert.Equal(result["manId"], "57"); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByManufacturerId"); } @@ -260,7 +242,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetProductByManufacturerId"); } @@ -273,7 +255,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); - Assert.Equal(result["controller"], "InlineConstraints_Products"); + Assert.Equal(result["controller"], "Products"); Assert.Equal(result["action"], "GetUserByName"); Assert.Equal(result["name"], "abc"); } @@ -299,7 +281,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); Assert.Equal(result["id"], "691cf17a-791b-4af8-99fd-e739e168170f"); - Assert.Equal(result["controller"], "InlineConstraints_Store"); + Assert.Equal(result["controller"], "Store"); Assert.Equal(result["action"], "GetStoreById"); } @@ -312,7 +294,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); - Assert.Equal(result["controller"], "InlineConstraints_Store"); + Assert.Equal(result["controller"], "Store"); Assert.Equal(result["action"], "GetStoreById"); } @@ -336,7 +318,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal(HttpStatusCode.OK, response.StatusCode); var result = await GetResponseValues(response); Assert.Equal(result["location"], "Bellevue"); - Assert.Equal(result["controller"], "InlineConstraints_Store"); + Assert.Equal(result["controller"], "Store"); Assert.Equal(result["action"], "GetStoreByLocation"); } @@ -395,7 +377,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, id:int? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductById", "id", "5", @@ -405,17 +387,17 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, id:int? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductById", "id", "sdsd", - "/area-exists/InlineConstraints_Products/GetProductById?id=sdsd" + string.Empty // Link generation expected to fail. }; // Attribute Route, name:alpha constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByName", "name", "zxcv", @@ -425,7 +407,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, name:length(1,20)? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByCategoryName", "name", "sports", @@ -435,7 +417,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, name:length(1,20)? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByCategoryName", null, null, @@ -445,7 +427,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, catId:int:range(10, 100) constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByCategoryId", "catId", "50", @@ -455,17 +437,17 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, catId:int:range(10, 100) constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByCategoryId", "catId", "500", - "/area-exists/InlineConstraints_Products/GetProductByCategoryId?catId=500" + string.Empty // Link generation expected to fail. }; // Attribute Route, name:length(1,20)? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByPrice", "price", "123.45", @@ -475,7 +457,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, price:float? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByManufacturerId", "manId", "15", @@ -485,27 +467,27 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Attribute Route, manId:int:min(10)? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByManufacturerId", "manId", "qwer", - "/area-exists/InlineConstraints_Products/GetProductByManufacturerId?manId=qwer" + string.Empty // Link generation expected to fail. }; // Attribute Route, manId:int:min(10)? constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByManufacturerId", "manId", "1", - "/area-exists/InlineConstraints_Products/GetProductByManufacturerId?manId=1" + string.Empty // Link generation expected to fail. }; // Attribute Route, dateTime:datetime constraint yield return new object[] { - "InlineConstraints_Products", + "Products", "GetProductByManufacturingDate", "dateTime", "2014-10-11T13:45:30", @@ -515,7 +497,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Conventional Route, id:guid? constraint yield return new object[] { - "InlineConstraints_Store", + "Store", "GetStoreById", "id", "691cf17a-791b-4af8-99fd-e739e168170f", diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonPatchTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonPatchSampleTest.cs similarity index 98% rename from test/Microsoft.AspNet.Mvc.FunctionalTests/JsonPatchTest.cs rename to test/Microsoft.AspNet.Mvc.FunctionalTests/JsonPatchSampleTest.cs index 5a02b5dfd..ef4774f6f 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonPatchTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonPatchSampleTest.cs @@ -6,16 +6,16 @@ using System.Collections.Generic; using System.Net.Http; using System.Text; using System.Threading.Tasks; -using JsonPatchWebSite.Models; +using JsonPatchSample.Web.Models; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class JsonPatchTest : IClassFixture> + public class JsonPatchSampleTest : IClassFixture> { - public JsonPatchTest(MvcTestFixture fixture) + public JsonPatchSampleTest(MvcTestFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationSampleTest.cs similarity index 93% rename from test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationTest.cs rename to test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationSampleTest.cs index 7fb57e680..35e139734 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/LocalizationSampleTest.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Net.Http; -using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNet.Testing; using Microsoft.Net.Http.Headers; @@ -12,12 +11,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class LocalizationTest : IClassFixture> + public class LocalizationSampleTest : IClassFixture> { - private const string SiteName = nameof(LocalizationWebSite); - private static readonly Assembly _assembly = typeof(LocalizationTest).GetTypeInfo().Assembly; - - public LocalizationTest(MvcTestFixture fixture) + public LocalizationSampleTest(MvcTestFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingAssert.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingAssert.cs deleted file mode 100644 index 5cf102f5b..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingAssert.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using LoggingWebSite; -using Xunit.Sdk; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public static class LoggingAssert - { - /// - /// Compares two trees and verifies if the scope nodes are equal - /// - /// - /// - /// - public static bool ScopesEqual(ScopeNodeDto expected, ScopeNodeDto actual) - { - // To enable diagnosis, here a flat-list(pe-order traversal based) of - // these trees is provided. - if (!AreScopesEqual(expected, actual)) - { - var expectedScopes = new List(); - var actualScopes = new List(); - - TraverseScopeTree(expected, expectedScopes); - TraverseScopeTree(actual, actualScopes); - - throw new EqualException(expected: string.Join(", ", expectedScopes), - actual: string.Join(", ", actualScopes)); - } - - return true; - } - - /// - /// Compares two trees and verifies if the scope nodes are equal - /// - /// - /// - /// - private static bool AreScopesEqual(ScopeNodeDto root1, ScopeNodeDto root2) - { - if (root1 == null && root2 == null) - { - return true; - } - - if (root1 == null || root2 == null) - { - return false; - } - - if (!string.Equals(root1.State?.ToString(), root2.State?.ToString(), StringComparison.OrdinalIgnoreCase) - || root1.Children.Count != root2.Children.Count) - { - return false; - } - - bool isChildScopeEqual = true; - for (int i = 0; i < root1.Children.Count; i++) - { - isChildScopeEqual = AreScopesEqual(root1.Children[i], root2.Children[i]); - - if (!isChildScopeEqual) - { - break; - } - } - - return isChildScopeEqual; - } - - /// - /// Traverses the scope node sub-tree and collects the list scopes - /// - /// - /// - private static void TraverseScopeTree(ScopeNodeDto root, List scopes) - { - if (root == null) - { - return; - } - - scopes.Add(root.State?.ToString()); - - foreach (var childScope in root.Children) - { - TraverseScopeTree(childScope, scopes); - } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingExtensions.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingExtensions.cs deleted file mode 100644 index d2bff9551..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/Logging/LoggingExtensions.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using LoggingWebSite; -using Microsoft.AspNet.WebUtilities; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public static class LoggingExtensions - { - public const string RequestTraceIdQueryKey = "RequestTraceId"; - - /// - /// Gets a scope node with the given name - /// - /// - /// - /// A scope node if found, else null - public static ScopeNodeDto FindScope(this IEnumerable activities, - string scopeName) - { - ScopeNodeDto node = null; - - foreach (var activity in activities) - { - if (activity.RepresentsScope) - { - node = GetScope(activity.Root, scopeName); - - // Ideally we do not expect multiple scopes with the same name - // to exist in the logs, so we break on the first found scope node. - // Note: The logs can contain multiple scopes with the same name across - // different requests, but the tests are expected to filter the logs by request - // (ex: using request trace id) and then find the scope by name. - if (node != null) - { - return node; - } - } - } - - return node; - } - - /// - /// Gets all the logs messages matching the given data type - /// - /// - /// - public static IEnumerable GetLogsByDataType(this IEnumerable activities) - { - var logInfos = new List(); - foreach (var activity in activities) - { - if (!activity.RepresentsScope) - { - var logInfo = activity.Root.Messages.OfDataType() - .FirstOrDefault(); - - if (logInfo != null) - { - logInfos.Add(logInfo); - } - } - else - { - GetLogsByDataType(activity.Root, logInfos); - } - } - - return logInfos; - } - - /// - /// Filters for logs activties created during application startup - /// - /// - /// - public static IEnumerable FilterByStartup(this IEnumerable activities) - { - return activities.Where(activity => activity.RequestInfo == null); - } - - /// - /// Filters log activities based on the given request. - /// - /// - /// The "RequestTraceId" query parameter value - /// - public static IEnumerable FilterByRequestTraceId(this IEnumerable activities, - string requestTraceId) - { - return activities.Where(activity => activity.RequestInfo != null - && string.Equals(GetQueryValue(activity.RequestInfo.Query, RequestTraceIdQueryKey), - requestTraceId, - StringComparison.OrdinalIgnoreCase)); - } - - /// - /// Filters the log messages based on the given data type - /// - /// - /// - public static IEnumerable OfDataType(this IEnumerable logInfos) - { - return logInfos.Where(logInfo => logInfo.StateType != null - && logInfo.StateType.Equals(typeof(T))); - } - - /// - /// Traverses through the log node tree and gets the log messages whose StateType - /// matches the supplied data type. - /// - /// - /// - private static void GetLogsByDataType(ScopeNodeDto node, IList logInfoDtos) - { - foreach (var logInfo in node.Messages.OfDataType()) - { - logInfoDtos.Add(logInfo); - } - - foreach (var scopeNode in node.Children) - { - GetLogsByDataType(scopeNode, logInfoDtos); - } - } - - private static ScopeNodeDto GetScope(ScopeNodeDto root, string scopeName) - { - if (string.Equals(root.State?.ToString(), - scopeName, - StringComparison.OrdinalIgnoreCase)) - { - return root; - } - - foreach (var childNode in root.Children) - { - var foundNode = GetScope(childNode, scopeName); - - if (foundNode != null) - { - return foundNode; - } - } - - return null; - } - - private static string GetQueryValue(string query, string key) - { - var queryString = QueryHelpers.ParseQuery(query); - - return queryString[key].FirstOrDefault(); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingBindingBehaviorTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingBindingBehaviorTest.cs deleted file mode 100644 index d17261123..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingBindingBehaviorTest.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using ModelBindingWebSite; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingBindingBehaviorTest : IClassFixture> - { - public ModelBindingBindingBehaviorTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task BindingBehavior_MissingRequiredProperties_ValidationErrors() - { - // Arrange - var url = "http://localhost/BindingBehavior/EchoModelValues"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var formData = new List> - { - new KeyValuePair("model.BehaviourOptionalProperty", "Hi"), - }; - - request.Content = new FormUrlEncodedContent(formData); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var errors = JsonConvert.DeserializeObject(body); - - Assert.Equal(2, errors.Count); - - var error = Assert.Single(errors, kvp => kvp.Key == "model.BehaviourRequiredProperty"); - Assert.Equal( - "A value for the 'BehaviourRequiredProperty' property was not provided.", - ((JArray)error.Value)[0].Value()); - - error = Assert.Single(errors, kvp => kvp.Key == "model.BindRequiredProperty"); - Assert.Equal( - "A value for the 'BindRequiredProperty' property was not provided.", - ((JArray)error.Value)[0].Value()); - } - - [Fact] - public async Task BindingBehavior_OptionalIsOptional() - { - // Arrange - var url = "http://localhost/BindingBehavior/EchoModelValues"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var formData = new List> - { - new KeyValuePair("model.BehaviourRequiredProperty", "Hello"), - new KeyValuePair("model.BindRequiredProperty", "World!"), - }; - - request.Content = new FormUrlEncodedContent(formData); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var model = JsonConvert.DeserializeObject(body); - - Assert.Null(model.BehaviourNeverProperty); - Assert.Null(model.BehaviourOptionalProperty); - Assert.Equal("Hello", model.BehaviourRequiredProperty); - Assert.Equal("World!", model.BindRequiredProperty); - Assert.Null(model.BindNeverProperty); - } - - [Fact] - public async Task BindingBehavior_Never_IsNotBound() - { - // Arrange - var url = "http://localhost/BindingBehavior/EchoModelValues"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var formData = new List> - { - - new KeyValuePair("model.BehaviourNeverProperty", "Ignored"), - new KeyValuePair("model.BehaviourOptionalProperty", "Optional"), - new KeyValuePair("model.BehaviourRequiredProperty", "Hello"), - new KeyValuePair("model.BindRequiredProperty", "World!"), - new KeyValuePair("model.BindNeverProperty", "Ignored"), - }; - - request.Content = new FormUrlEncodedContent(formData); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var model = JsonConvert.DeserializeObject(body); - - Assert.Null(model.BehaviourNeverProperty); - Assert.Equal("Optional", model.BehaviourOptionalProperty); - Assert.Equal("Hello", model.BehaviourRequiredProperty); - Assert.Equal("World!", model.BindRequiredProperty); - Assert.Null(model.BindNeverProperty); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingDataMemberRequiredTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingDataMemberRequiredTest.cs deleted file mode 100644 index 9c86b2dd0..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingDataMemberRequiredTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using ModelBindingWebSite; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingDataMemberRequiredTest : IClassFixture> - { - public ModelBindingDataMemberRequiredTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task DataMember_MissingRequiredProperty_ValidationError() - { - // Arrange - var url = "http://localhost/DataMemberRequired/EchoModelValues"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var formData = new List> - { - new KeyValuePair("model.ExplicitlyOptionalProperty", "Hi"), - }; - - request.Content = new FormUrlEncodedContent(formData); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var errors = JsonConvert.DeserializeObject(body); - - Assert.Equal(1, errors.Count); - - var error = Assert.Single(errors, kvp => kvp.Key == "model.RequiredProperty"); - Assert.Equal( - "A value for the 'RequiredProperty' property was not provided.", - ((JArray)error.Value)[0].Value()); - } - - [Fact] - public async Task DataMember_RequiredPropertyProvided_Success() - { - // Arrange - var url = "http://localhost/DataMemberRequired/EchoModelValues"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var formData = new List> - { - new KeyValuePair("model.ImplicitlyOptionalProperty", "Hello"), - new KeyValuePair("model.ExplicitlyOptionalProperty", "World!"), - new KeyValuePair("model.RequiredProperty", "Required!"), - }; - - request.Content = new FormUrlEncodedContent(formData); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var model = JsonConvert.DeserializeObject(body); - - Assert.Equal("Hello", model.ImplicitlyOptionalProperty); - Assert.Equal("World!", model.ExplicitlyOptionalProperty); - Assert.Equal("Required!", model.RequiredProperty); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromFormTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromFormTest.cs deleted file mode 100644 index a36ee7298..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromFormTest.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; -using ModelBindingWebSite; -using ModelBindingWebSite.Controllers; -using ModelBindingWebSite.Models; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingFromFormTest : IClassFixture> - { - public ModelBindingFromFormTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task FromForm_CustomModelPrefix_ForParameter() - { - // Arrange - var url = "http://localhost/FromFormAttribute_Company/CreateCompany"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var nameValueCollection = new List> - { - new KeyValuePair("customPrefix.Employees[0].Name", "somename"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - - Assert.Equal("somename", employee.Name); - } - - [Fact] - public async Task FromForm_CustomModelPrefix_ForCollectionParameter() - { - // Arrange - var url = "http://localhost/FromFormAttribute_Company/CreateCompanyFromEmployees"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var nameValueCollection = new List> - { - new KeyValuePair("customPrefix[0].Department", "Contoso"), - }; - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - Assert.Equal("Contoso", employee.Department); - } - - [Fact] - public async Task FromForm_CustomModelPrefix_ForProperty() - { - // Arrange - var url = "http://localhost/FromFormAttribute_Company/CreateCompany"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var nameValueCollection = new List> - { - new KeyValuePair("customPrefix.Employees[0].EmployeeSSN", "123132131"), - }; - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - Assert.Equal("123132131", employee.SSN); - } - - [Fact] - public async Task FromForm_CustomModelPrefix_ForCollectionProperty() - { - // Arrange - var url = "http://localhost/FromFormAttribute_Company/CreateDepartment"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - var nameValueCollection = new List> - { - new KeyValuePair("department.TestEmployees[0].EmployeeSSN", "123132131"), - }; - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var department = JsonConvert.DeserializeObject< - FromFormAttribute_CompanyController.FromForm_Department>(body); - - var employee = Assert.Single(department.Employees); - Assert.Equal("123132131", employee.SSN); - } - - [Fact] - public async Task FromForm_NonExistingValueAddsValidationErrors_OnProperty_UsingCustomModelPrefix() - { - // Arrange - var url = "http://localhost/FromFormAttribute_Company/ValidateDepartment"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - - // No values. - var nameValueCollection = new List>(); - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - Assert.Null(result.Value); - var error = Assert.Single(result.ModelStateErrors); - Assert.Equal("TestEmployees", error); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromHeaderTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromHeaderTest.cs deleted file mode 100644 index 966173e41..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromHeaderTest.cs +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.Extensions.DependencyInjection; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingFromHeaderTest : IClassFixture> - { - public ModelBindingFromHeaderTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - // The action that this test hits will echo back the model-bound value - [Theory] - [InlineData("transactionId", "1e331f25-0869-4c87-8a94-64e6e40cb5a0")] - [InlineData("TransaCtionId", "1e331f25-0869-4c87-8a94-64e6e40cb5a0")] // Case-Insensitive - [InlineData("TransaCtionId", "1e331f25-0869-4c87-8a94-64e6e40cb5a0,abcd")] // Binding to string doesn't split values - public async Task FromHeader_BindHeader_ToString_OnParameter(string headerName, string headerValue) - { - // Arrange - var expected = headerValue; - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToStringParameter"); - request.Headers.TryAddWithoutValidation(headerName, headerValue); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - Assert.Equal(expected, result.HeaderValue); - } - - [Fact] - public async Task FromHeader_BindHeader_ToString_OnProperty_CustomName() - { - // Arrange - var title = "How to make really really good soup."; - var tags = new string[] { "Cooking", "Recipes", "Awesome" }; - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToProperty/CustomName"); - request.Headers.TryAddWithoutValidation("BlogTitle", title); - request.Headers.TryAddWithoutValidation("BlogTags", string.Join(", ", tags)); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - Assert.Equal(title, result.HeaderValue); - Assert.Equal(tags, result.HeaderValues); - Assert.Empty(result.ModelStateErrors); - } - - [Fact] - public async Task FromHeader_NonExistingHeaderAddsValidationErrors_OnProperty_CustomName() - { - // Arrange - var tags = new string[] { "Cooking", "Recipes", "Awesome" }; - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToProperty/CustomName"); - request.Headers.TryAddWithoutValidation("BlogTags", string.Join(", ", tags)); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - Assert.Equal(tags, result.HeaderValues); - var error = Assert.Single(result.ModelStateErrors); - Assert.Equal("BlogTitle", error); - } - - [Fact] - public async Task FromHeader_NonExistingHeaderAddsValidationErrors_OnCollectionProperty_CustomName() - { - // Arrange - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToProperty/CustomName"); - request.Headers.TryAddWithoutValidation("BlogTitle", "Cooking Receipes."); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - Assert.Equal("Cooking Receipes.", result.HeaderValue); - var error = Assert.Single(result.ModelStateErrors); - Assert.Equal("BlogTags", error); - } - - // The action that this test hits will echo back the model-bound value - [Fact] - public async Task FromHeader_BindHeader_ToString_OnParameter_CustomName() - { - // Arrange - var expected = "1e331f25-0869-4c87-8a94-64e6e40cb5a0"; - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToStringParameter/CustomName"); - request.Headers.TryAddWithoutValidation("tId", "1e331f25-0869-4c87-8a94-64e6e40cb5a0"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - - Assert.Equal(expected, result.HeaderValue); - Assert.Null(result.HeaderValues); - Assert.Empty(result.ModelStateErrors); - } - - // There should be no model state error for a top-level object - [Theory] - [InlineData("transactionId1234", "1e331f25-0869-4c87-8a94-64e6e40cb5a0")] - public async Task FromHeader_BindHeader_ToString_OnParameter_NoValues(string headerName, string headerValue) - { - // Arrange - var expected = headerValue; - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToStringParameter"); - request.Headers.TryAddWithoutValidation(headerName, headerValue); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - - Assert.Null(result.HeaderValue); - Assert.Null(result.HeaderValues); - Assert.Empty(result.ModelStateErrors); - } - - // There should be no model state error for a top-level object - [Theory] - [InlineData("transactionId1234", "1e331f25-0869-4c87-8a94-64e6e40cb5a0")] - public async Task FromHeader_BindHeader_ToString_OnParameter_NoValues_DefaultValue( - string headerName, - string headerValue) - { - // Arrange - // Intentionally not setting a header value - var request = new HttpRequestMessage( - HttpMethod.Get, - "http://localhost/Blog/BindToStringParameterDefaultValue"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - - Assert.Equal("default-value", result.HeaderValue); - Assert.Null(result.HeaderValues); - Assert.Empty(result.ModelStateErrors); - } - - // The action that this test hits will echo back the model-bound values - [Theory] - [InlineData("transactionIds", "1e331f25-0869-4c87-8a94-64e6e40cb5a0")] - [InlineData("transactionIds", "1e331f25-0869-4c87-8a94-64e6e40cb5a0,abcd,efg")] - public async Task FromHeader_BindHeader_ToStringArray_OnParameter(string headerName, string headerValue) - { - // Arrange - var expected = headerValue.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToStringArrayParameter"); - request.Headers.TryAddWithoutValidation(headerName, headerValue); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - - Assert.Null(result.HeaderValue); - Assert.Equal(expected, result.HeaderValues); - Assert.Empty(result.ModelStateErrors); - } - - // The action that this test hits will echo back the model-bound values - [Fact] - public async Task FromHeader_BindHeader_ToModel() - { - // Arrange - var title = "How to make really really good soup."; - var tags = new string[] { "Cooking", "Recipes", "Awesome" }; - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToModel?author=Marvin"); - request.Headers.TryAddWithoutValidation("title", title); - request.Headers.TryAddWithoutValidation("tags", string.Join(", ", tags)); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - - Assert.Equal(title, result.HeaderValue); - Assert.Equal(tags, result.HeaderValues); - Assert.Empty(result.ModelStateErrors); - } - - // Title on the model has [Required] so it will have a validation error - // Tags does not, so no error. - [Fact] - public async Task FromHeader_BindHeader_ToModel_NoValues_ValidationError() - { - // Arrange - // Intentionally not setting a title or tags - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Blog/BindToModel?author=Marvin"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - - Assert.Null(result.HeaderValue); - Assert.Null(result.HeaderValues); - - var error = Assert.Single(result.ModelStateErrors); - Assert.Equal("Title", error); - } - - // This model sets a value for 'Title', and the model binder won't trounce it. - // - // There's no validation error because we validate the value on the model. - [Fact] - public async Task FromHeader_BindHeader_ToModel_NoValues_InitializedValue_NoValidationError() - { - // Arrange - // Intentionally not setting a title or tags - var request = new HttpRequestMessage( - HttpMethod.Get, - "http://localhost/Blog/BindToModelWithInitializedValue?author=Marvin"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - - Assert.Equal("How to Make Soup", result.HeaderValue); - Assert.Equal(new[] { "Cooking" }, result.HeaderValues); - - Assert.Empty(result.ModelStateErrors); - } - - private class Result - { - public string HeaderValue { get; set; } - - public string[] HeaderValues { get; set; } - - public string[] ModelStateErrors { get; set; } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromQueryTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromQueryTest.cs deleted file mode 100644 index 282d51fb7..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromQueryTest.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Net.Http; -using System.Threading.Tasks; -using ModelBindingWebSite; -using ModelBindingWebSite.Controllers; -using ModelBindingWebSite.Models; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingFromQueryTest : IClassFixture> - { - public ModelBindingFromQueryTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task FromQuery_CustomModelPrefix_ForParameter() - { - // Arrange - // [FromQuery(Name = "customPrefix")] is used to apply a prefix - var url = - "http://localhost/FromQueryAttribute_Company/CreateCompany?customPrefix.Employees[0].Name=somename"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - Assert.Equal("somename", employee.Name); - } - - [Fact] - public async Task FromQuery_CustomModelPrefix_ForCollectionParameter() - { - // Arrange - var url = - "http://localhost/FromQueryAttribute_Company/CreateCompanyFromEmployees?customPrefix[0].Name=somename"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - Assert.Equal("somename", employee.Name); - } - - [Fact] - public async Task FromQuery_CustomModelPrefix_ForProperty() - { - // Arrange - // [FromQuery(Name = "EmployeeId")] is used to apply a prefix - var url = - "http://localhost/FromQueryAttribute_Company/CreateCompany?customPrefix.Employees[0].EmployeeId=1234"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - - Assert.Equal(1234, employee.Id); - } - - [Fact] - public async Task FromQuery_CustomModelPrefix_ForCollectionProperty() - { - // Arrange - var url = "http://localhost/FromQueryAttribute_Company/CreateDepartment?TestEmployees[0].EmployeeId=1234"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var department = JsonConvert.DeserializeObject< - FromQueryAttribute_CompanyController.FromQuery_Department>(body); - - var employee = Assert.Single(department.Employees); - Assert.Equal(1234, employee.Id); - } - - [Fact] - public async Task FromQuery_NonExistingValueAddsValidationErrors_OnProperty_UsingCustomModelPrefix() - { - // Arrange - var url = - "http://localhost/FromQueryAttribute_Company/ValidateDepartment?TestEmployees[0].Department=contoso"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - var error = Assert.Single(result.ModelStateErrors); - Assert.Equal("TestEmployees[0].EmployeeId", error); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromRouteTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromRouteTest.cs deleted file mode 100644 index 3cdac2731..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingFromRouteTest.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; -using ModelBindingWebSite; -using ModelBindingWebSite.Models; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingFromRouteTest : IClassFixture> - { - public ModelBindingFromRouteTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task FromRoute_CustomModelPrefix_ForParameter() - { - // Arrange - // [FromRoute(Name = "customPrefix")] is used to apply a prefix - var url = "http://localhost/FromRouteAttribute_Company/CreateEmployee/somename"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var employee = JsonConvert.DeserializeObject(body); - Assert.Equal("somename", employee.Name); - } - - [Fact] - public async Task FromRoute_CustomModelPrefix_ForProperty() - { - // Arrange - // [FromRoute(Name = "EmployeeId")] is used to apply a prefix - var url = "http://localhost/FromRouteAttribute_Company/CreateEmployee/somename/1234"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var employee = JsonConvert.DeserializeObject(body); - Assert.Equal(1234, employee.TaxId); - } - - - [Fact] - public async Task FromRoute_NonExistingValueAddsValidationErrors_OnProperty_UsingCustomModelPrefix() - { - // Arrange - // [FromRoute(Name = "TestEmployees")] is used to apply a prefix - var url = "http://localhost/FromRouteAttribute_Company/ValidateDepartment/contoso"; - var request = new HttpRequestMessage(HttpMethod.Post, url); - - // No values. - var nameValueCollection = new List>(); - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(body); - Assert.Null(result.Value); - var error = Assert.Single(result.ModelStateErrors); - Assert.Equal("TestEmployees", error); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingModelBinderAttributeTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingModelBinderAttributeTest.cs deleted file mode 100644 index a63e4e56f..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingModelBinderAttributeTest.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Net.Http; -using System.Threading.Tasks; -using ModelBindingWebSite.Models; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingModelBinderAttributeTest : IClassFixture> - { - public ModelBindingModelBinderAttributeTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task ModelBinderAttribute_CustomModelPrefix() - { - // Arrange - // [ModelBinder(Name = "customPrefix")] is used to apply a prefix - var url = - "http://localhost/ModelBinderAttribute_Company/GetCompany?customPrefix.Employees[0].Name=somename"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - Assert.Equal("somename", employee.Name); - } - - [Fact] - public async Task ModelBinderAttribute_CustomModelPrefix_OnProperty() - { - // Arrange - var url = "http://localhost/ModelBinderAttribute_Company/CreateCompany?employees[0].Alias=somealias"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - var company = JsonConvert.DeserializeObject(body); - - var employee = Assert.Single(company.Employees); - Assert.Equal("somealias", employee.EmailAlias); - } - - [Fact] - public async Task ModelBinderAttribute_WithPrefixOnParameter() - { - // Arrange - // [ModelBinder(Name = "customPrefix")] is used to apply a prefix - var url = "http://localhost/ModelBinderAttribute_Product/GetBinderType_UseModelBinderOnType" + - "?customPrefix.ProductId=5"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - Assert.Equal( - "ModelBindingWebSite.Controllers.ModelBinderAttribute_ProductController+ProductModelBinder", - body); - } - - [Fact] - public async Task ModelBinderAttribute_WithBinderOnParameter() - { - // Arrange - var url = "http://localhost/ModelBinderAttribute_Product/GetBinderType_UseModelBinder/" + - "?model.productId=5"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - Assert.Equal( - "ModelBindingWebSite.Controllers.ModelBinderAttribute_ProductController+ProductModelBinder", - body); - } - - [Fact] - public async Task ModelBinderAttribute_WithBinderOnEnum() - { - // Arrange - var url = "http://localhost/ModelBinderAttribute_Product/ModelBinderAttribute_UseModelBinderOnEnum" + - "?status=Shipped"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - var body = await response.Content.ReadAsStringAsync(); - Assert.Equal("StatusShipped", body); - } - - private class Product - { - public int ProductId { get; set; } - - public string BinderType { get; set; } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingTest.cs deleted file mode 100644 index 726275d7b..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ModelBindingTest.cs +++ /dev/null @@ -1,1835 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Net; -using System.Net.Http; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNet.Testing; -#if DNX451 -using Microsoft.AspNet.Testing.xunit; -#endif -using ModelBindingWebSite.Models; -using ModelBindingWebSite.ViewModels; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class ModelBindingTest : IClassFixture> - { - private static readonly Assembly _assembly = typeof(ModelBindingTest).GetTypeInfo().Assembly; - - public ModelBindingTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task DoNotValidate_ParametersOrControllerProperties_IfSourceNotFromRequest() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/Validation/DoNotValidateParameter"); - - // Assert - Assert.Equal("true", response); - } - - [Fact] - public async Task ModelValidation_DoesNotValidate_AnAlreadyValidatedObject() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/Validation/AvoidRecursive?Name=selfish"); - - // Assert - Assert.Equal("true", response); - } - - [Theory] - [InlineData("RestrictValueProvidersUsingFromRoute", "valueFromRoute")] - [InlineData("RestrictValueProvidersUsingFromQuery", "valueFromQuery")] - [InlineData("RestrictValueProvidersUsingFromForm", "valueFromForm")] - public async Task CompositeModelBinder_Restricts_ValueProviders(string actionName, string expectedValue) - { - // Arrange - // Provide all three values, it should bind based on the attribute on the action method. - var request = new HttpRequestMessage( - HttpMethod.Post, - string.Format("http://localhost/CompositeTest/{0}/valueFromRoute?param=valueFromQuery", actionName)); - var nameValueCollection = new List> - { - new KeyValuePair("param", "valueFromForm"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal(expectedValue, await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task TryUpdateModel_WithAPropertyFromBody() - { - // Arrange - // the name would be of customer.Department.Name - // and not for the top level customer object. - var input = "{\"Name\":\"RandomDepartment\"}"; - var content = new StringContent(input, Encoding.UTF8, "application/json"); - - // Act - var response = await Client.PostAsync("http://localhost/Home/GetCustomer?Id=1234", content); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var customer = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(customer.Department); - Assert.Equal("RandomDepartment", customer.Department.Name); - Assert.Equal(1234, customer.Id); - Assert.Equal(25, customer.Age); - Assert.Equal("dummy", customer.Name); - } - - [Fact] - public async Task CanModelBindServiceToAnArgument() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/FromServices_Calculator/Add?left=1234&right=1"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("1235", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CanModelBindServiceToAProperty() - { - // Arrange & Act - var response = await Client.GetAsync( - "http://localhost/FromServices_Calculator/Calculate?Left=10&Right=5&Operator=*"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("50", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task CanModelBindServiceToAProperty_OnBaseType() - { - // Arrange & Act - var response = await Client.GetAsync( - "http://localhost/FromServices_Calculator/CalculateWithPrecision?Left=10&Right=5&Operator=*"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("50", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ControllerPropertyAndAnActionWithoutFromBody_InvokesWithoutErrors() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/FromBodyControllerProperty/GetSiteUser"); - - // Assert - Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); - } - - [Fact] - public async Task CanBind_MultipleParameters_UsingFromForm() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "http://localhost/FromAttributes/MultipleFromFormParameters"); - var nameValueCollection = new List> - { - new KeyValuePair("homeAddress.Street", "1"), - new KeyValuePair("homeAddress.State", "WA_Form_Home"), - new KeyValuePair("homeAddress.Zip", "2"), - new KeyValuePair("officeAddress.Street", "3"), - new KeyValuePair("officeAddress.State", "WA_Form_Office"), - new KeyValuePair("officeAddress.Zip", "4"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var user = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - - Assert.Equal("WA_Form_Home", user.HomeAddress.State); - Assert.Equal(1, user.HomeAddress.Street); - Assert.Equal(2, user.HomeAddress.Zip); - - Assert.Equal("WA_Form_Office", user.OfficeAddress.State); - Assert.Equal(3, user.OfficeAddress.Street); - Assert.Equal(4, user.OfficeAddress.Zip); - } - - [Fact] - public async Task CanBind_MultipleProperties_UsingFromForm() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "http://localhost/FromAttributes/MultipleFromFormParameterAndProperty"); - var nameValueCollection = new List> - { - new KeyValuePair("Street", "1"), - new KeyValuePair("State", "WA_Form_Home"), - new KeyValuePair("Zip", "2"), - new KeyValuePair("officeAddress.Street", "3"), - new KeyValuePair("officeAddress.State", "WA_Form_Office"), - new KeyValuePair("officeAddress.Zip", "4"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var user = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - - Assert.Equal("WA_Form_Home", user.HomeAddress.State); - Assert.Equal(1, user.HomeAddress.Street); - Assert.Equal(2, user.HomeAddress.Zip); - - Assert.Equal("WA_Form_Office", user.OfficeAddress.State); - Assert.Equal(3, user.OfficeAddress.Street); - Assert.Equal(4, user.OfficeAddress.Zip); - } - - [Fact] - public async Task CanBind_ComplexData_OnParameters_UsingFromAttributes() - { - // Arrange - // Provide all three values, it should bind based on the attribute on the action method. - var request = new HttpRequestMessage( - HttpMethod.Post, - "http://localhost/FromAttributes/GetUser/5/WA_Route/6" + - "?Street=3&State=WA_Query&Zip=4"); - var nameValueCollection = new List> - { - new KeyValuePair("Street", "1"), - new KeyValuePair("State", "WA_Form"), - new KeyValuePair("Zip", "2"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var user = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - - // Assert FromRoute - Assert.Equal("WA_Route", user.HomeAddress.State); - Assert.Equal(5, user.HomeAddress.Street); - Assert.Equal(6, user.HomeAddress.Zip); - - // Assert FromForm - Assert.Equal("WA_Form", user.OfficeAddress.State); - Assert.Equal(1, user.OfficeAddress.Street); - Assert.Equal(2, user.OfficeAddress.Zip); - - // Assert FromQuery - Assert.Equal("WA_Query", user.ShippingAddress.State); - Assert.Equal(3, user.ShippingAddress.Street); - Assert.Equal(4, user.ShippingAddress.Zip); - } - - [Fact] - public async Task CanBind_ComplexData_OnProperties_UsingFromAttributes() - { - // Arrange - // Provide all three values, it should bind based on the attribute on the action method. - var request = new HttpRequestMessage( - HttpMethod.Post, - "http://localhost/FromAttributes/GetUser_FromForm/5/WA_Route/6" + - "?ShippingAddress.Street=3&ShippingAddress.State=WA_Query&ShippingAddress.Zip=4"); - var nameValueCollection = new List> - { - new KeyValuePair("OfficeAddress.Street", "1"), - new KeyValuePair("OfficeAddress.State", "WA_Form"), - new KeyValuePair("OfficeAddress.Zip", "2"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var user = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - - // Assert FromRoute - Assert.Equal("WA_Route", user.HomeAddress.State); - Assert.Equal(5, user.HomeAddress.Street); - Assert.Equal(6, user.HomeAddress.Zip); - - // Assert FromForm - Assert.Equal("WA_Form", user.OfficeAddress.State); - Assert.Equal(1, user.OfficeAddress.Street); - Assert.Equal(2, user.OfficeAddress.Zip); - - // Assert FromQuery - Assert.Equal("WA_Query", user.ShippingAddress.State); - Assert.Equal(3, user.ShippingAddress.Street); - Assert.Equal(4, user.ShippingAddress.Zip); - } - - [Fact] - public async Task CanBind_ComplexData_OnProperties_UsingFromAttributes_WithBody() - { - // Arrange - // Provide all three values, it should bind based on the attribute on the action method. - var request = new HttpRequestMessage( - HttpMethod.Post, - "http://localhost/FromAttributes/GetUser_FromBody/5/WA_Route/6" + - "?ShippingAddress.Street=3&ShippingAddress.State=WA_Query&ShippingAddress.Zip=4"); - var input = "{\"State\":\"WA_Body\",\"Street\":1,\"Zip\":2}"; - - request.Content = new StringContent(input, Encoding.UTF8, "application/json"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var user = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - - // Assert FromRoute - Assert.Equal("WA_Route", user.HomeAddress.State); - Assert.Equal(5, user.HomeAddress.Street); - Assert.Equal(6, user.HomeAddress.Zip); - - // Assert FromBody - Assert.Equal("WA_Body", user.OfficeAddress.State); - Assert.Equal(1, user.OfficeAddress.Street); - Assert.Equal(2, user.OfficeAddress.Zip); - - // Assert FromQuery - Assert.Equal("WA_Query", user.ShippingAddress.State); - Assert.Equal(3, user.ShippingAddress.Street); - Assert.Equal(4, user.ShippingAddress.Zip); - } - - - [Fact] - public async Task NonExistingModelBinder_ForABinderMetadata_DoesNotRecurseInfinitely() - { - // Arrange & Act & Assert - var response = await Client.GetStringAsync("http://localhost/WithBinderMetadata/EchoDocument"); - var document = JsonConvert.DeserializeObject(response); - - Assert.NotNull(document); - Assert.Null(document.Version); - Assert.Null(document.SubDocument); - } - - [Fact] - public async Task ParametersWithNoValueProviderMetadataUseTheAvailableValueProviders() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/WithBinderMetadata" + - "/ParametersWithNoValueProviderMetadataUseTheAvailableValueProviders" + - "?Name=somename&Age=12"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var emp = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.Null(emp.Department); - Assert.Equal("somename", emp.Name); - Assert.Equal(12, emp.Age); - } - - [Fact] - public async Task ParametersAreAlwaysCreated_IfValuesAreProvidedWithoutModelName() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/WithoutBinderMetadata" + - "/GetPersonParameter" + - "?Name=somename&Age=12"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var person = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(person); - Assert.Equal("somename", person.Name); - Assert.Equal(12, person.Age); - } - - [Fact] - public async Task ParametersAreAlwaysCreated_IfValueIsProvidedForModelName() - { - // Arrange & Act - // here p is the model name. - var response = await Client.GetAsync("http://localhost/WithoutBinderMetadata/GetPersonParameter?p="); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var person = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(person); - Assert.Null(person.Name); - Assert.Equal(0, person.Age); - } - - [Fact] - public async Task ParametersAreAlwaysCreated_IfNoValuesAreProvided() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/WithoutBinderMetadata/GetPersonParameter"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var person = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(person); - Assert.Null(person.Name); - Assert.Equal(0, person.Age); - } - - [Fact] - public async Task PropertiesAreBound_IfTheyAreProvidedByValueProviders() - { - // Arrange & Act - var response = await Client.GetAsync( - "http://localhost/Properties/GetCompany?Employees[0].Name=somename&Age=12"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var company = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(company); - Assert.NotNull(company.Employees); - Assert.Equal(1, company.Employees.Count); - Assert.NotNull(company.Employees[0].Name); - } - - [Fact] - public async Task PropertiesAreBound_IfTheyAreMarkedExplicitly() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Properties/GetCompany"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var company = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(company); - Assert.NotNull(company.CEO); - Assert.Null(company.CEO.Name); - } - - [Fact] - public async Task PropertiesAreBound_IfTheyArePocoMetadataMarkedTypes() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Properties/GetCompany"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var company = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(company); - - // Department property is not null because it was a marker poco. - Assert.NotNull(company.Department); - - // beacause no value is provided. - Assert.Null(company.Department.Name); - } - - [Fact] - public async Task PropertiesAreNotBound_ByDefault() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Properties/GetCompany"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var company = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.NotNull(company); - Assert.Null(company.Employees); - } - - [Fact] - public async Task PocoGetsCreated_IfTopLevelNoProperties() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Properties/GetPerson"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var person = JsonConvert.DeserializeObject( - await response.Content.ReadAsStringAsync()); - Assert.NotNull(person); - Assert.Null(person.Name); - } - - [Fact] - public async Task ArrayOfPocoGetsCreated_PoCoWithNoProperties() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Properties/GetPeople?people[0].Name=asdf"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var arrperson = JsonConvert.DeserializeObject( - await response.Content.ReadAsStringAsync()); - Assert.NotNull(arrperson); - Assert.NotNull(arrperson.people); - Assert.Equal(0, arrperson.people.Length); - } - - [Theory] - [InlineData("http://localhost/Home/ActionWithPersonFromUrlWithPrefix/Javier/26")] - [InlineData("http://localhost/Home/ActionWithPersonFromUrlWithoutPrefix/Javier/26")] - public async Task CanBind_ComplexData_FromRouteData(string url) - { - // Arrange & Act - var response = await Client.GetAsync(url); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - Assert.NotNull(body); - - var person = JsonConvert.DeserializeObject(body); - Assert.NotNull(person); - Assert.Equal("Javier", person.Name); - Assert.Equal(26, person.Age); - } - - [Fact] - public async Task ModelBindCancellationTokenParameteres() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Home/ActionWithCancellationToken"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("true", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ModelBindCancellationToken_ForProperties() - { - // Arrange & Act - var response = await Client.GetAsync( - "http://localhost/Home/ActionWithCancellationTokenModel?wrapper=bogusValue"); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("true", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ModelBindingBindsBase64StringsToByteArrays() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Home/Index?byteValues=SGVsbG9Xb3JsZA=="); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal("HelloWorld", await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ModelBindingBindsEmptyStringsToByteArrays() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/Home/Index?byteValues="); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal(string.Empty, await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task ModelBinding_LimitsErrorsToMaxErrorCount_DoesNotValidateMembersOfMissingProperties() - { - // Arrange - var queryString = string.Join("=&", Enumerable.Range(0, 10).Select(i => "field" + i)); - - // Act - var response = await Client.GetStringAsync( - "http://localhost/Home/ModelWithTooManyValidationErrors?" + queryString); - - // Assert - var json = JsonConvert.DeserializeObject>(response); - - // 8 is the value of MaxModelValidationErrors for the application being tested. - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal(8, json.Count); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field1 field is required."), json["Field1"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field2 field is required."), json["Field2"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field3 field is required."), json["Field3"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field4 field is required."), json["Field4"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field5 field is required."), json["Field5"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field6 field is required."), json["Field6"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field7 field is required."), json["Field7"]); - Assert.Equal("The maximum number of allowed model errors has been reached.", json[""]); - } - - [Fact] - public async Task ModelBinding_FallsBackAndValidatesAllPropertiesInModel() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/Home/ModelWithFewValidationErrors?model="); - - // Assert - var json = JsonConvert.DeserializeObject>(response); - Assert.Equal(3, json.Count); - - // The model prefix 'model' is used in the modelstate keys because the key 'model' is present in the - // query string. This causes modelbinding to commit to using the prefix. - // - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field1 field is required."), json["model.Field1"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field2 field is required."), json["model.Field2"]); - Assert.Equal(PlatformNormalizer.NormalizeContent("The Field3 field is required."), json["model.Field3"]); - } - - [Fact] - public async Task ModelBinding_FallsBackAndSuccessfullyBindsStructCollection() - { - // Arrange - var contentDictionary = new Dictionary - { - { "[0]", "23" }, - { "[1]", "97" }, - { "[2]", "103" }, - }; - var requestContent = new FormUrlEncodedContent(contentDictionary); - - // Act - var response = await Client.PostAsync("http://localhost/integers", requestContent); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); - var array = JsonConvert.DeserializeObject(responseContent); - - Assert.Equal(3, array.Length); - Assert.Equal(23, array[0]); - Assert.Equal(97, array[1]); - Assert.Equal(103, array[2]); - } - - [Fact] - public async Task ModelBinding_FallsBackAndSuccessfullyBindsPOCOCollection() - { - // Arrange - var contentDictionary = new Dictionary - { - { "[0].CityCode", "YYZ" }, - { "[0].CityName", "Toronto" }, - { "[1].CityCode", "SEA" }, - { "[1].CityName", "Seattle" }, - }; - var requestContent = new FormUrlEncodedContent(contentDictionary); - - // Act - var response = await Client.PostAsync("http://localhost/cities", requestContent); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); - var list = JsonConvert.DeserializeObject>(responseContent); - - Assert.Equal(2, list.Count); - Assert.Equal(contentDictionary["[0].CityCode"], list[0].CityCode); - Assert.Equal(contentDictionary["[0].CityName"], list[0].CityName); - Assert.Equal(contentDictionary["[1].CityCode"], list[1].CityCode); - Assert.Equal(contentDictionary["[1].CityName"], list[1].CityName); - } - - [Fact] - public async Task BindAttribute_Filters_UsingDefaultPropertyFilterProvider_WithExpressions() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "EchoUser" + - "?user.UserName=someValue&user.RegisterationMonth=March&user.Id=123"); - - // Assert - var json = JsonConvert.DeserializeObject(response); - - // Does not touch what is not in the included expression. - Assert.Equal(0, json.Id); - - // Updates the included properties. - Assert.Equal("someValue", json.UserName); - Assert.Equal("March", json.RegisterationMonth); - } - - [Fact] - public async Task BindAttribute_Filters_UsingPropertyFilterProvider_UsingServices() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "EchoUserUsingServices" + - "?user.UserName=someValue&user.RegisterationMonth=March&user.Id=123"); - - // Assert - var json = JsonConvert.DeserializeObject(response); - - // Does not touch what is not in the included expression. - Assert.Equal(0, json.Id); - - // Updates the included properties. - Assert.Equal("someValue", json.UserName); - Assert.Equal("March", json.RegisterationMonth); - } - - [Fact] - public async Task BindAttribute_Filters_UsingDefaultPropertyFilterProvider_WithPredicate() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "UpdateUserId_BlackListingAtEitherLevelDoesNotBind" + - "?param1.LastName=someValue¶m2.Id=123"); - - // Assert - var json = JsonConvert.DeserializeObject>(response); - Assert.Equal(2, json.Count); - Assert.Null(json["param1.LastName"]); - Assert.Equal("0", json["param2.Id"]); - } - - [Fact] - public async Task BindAttribute_AppliesAtBothParameterAndTypeLevelTogether_BlacklistedAtEitherLevelIsNotBound() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "UpdateUserId_BlackListingAtEitherLevelDoesNotBind" + - "?param1.LastName=someValue¶m2.Id=123"); - - // Assert - var json = JsonConvert.DeserializeObject>(response); - Assert.Equal(2, json.Count); - Assert.Null(json["param1.LastName"]); - Assert.Equal("0", json["param2.Id"]); - } - - [Fact] - public async Task BindAttribute_AppliesAtBothParameterAndTypeLevelTogether_IncludedAtBothLevelsIsBound() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "UpdateFirstName_IncludingAtBothLevelBinds" + - "?param1.FirstName=someValue¶m2.Id=123"); - - // Assert - var json = JsonConvert.DeserializeObject>(response); - Assert.Equal(1, json.Count); - Assert.Equal("someValue", json["param1.FirstName"]); - } - - [Fact] - public async Task BindAttribute_AppliesAtBothParameterAndTypeLevelTogether_IncludingAtOneLevelIsNotBound() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "UpdateIsAdmin_IncludingAtOnlyOneLevelDoesNotBind" + - "?param1.FirstName=someValue¶m1.IsAdmin=true"); - - // Assert - var json = JsonConvert.DeserializeObject>(response); - Assert.Equal(2, json.Count); - Assert.Equal("False", json["param1.IsAdmin"]); - Assert.Null(json["param1.FirstName"]); - } - - [Fact] - public async Task BindAttribute_BindsUsingParameterPrefix() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "BindParameterUsingParameterPrefix" + - "?randomPrefix.Value=someValue"); - - // Assert - Assert.Equal("someValue", response); - } - - [Fact] - public async Task BindAttribute_FallsBackOnTypePrefixIfNoParameterPrefixIsProvided() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/BindAttribute/" + - "TypePrefixIsUsed" + - "?TypePrefix.Value=someValue"); - - // Assert - Assert.Equal("someValue", response); - } - - [Fact] - public async Task BindAttribute_DoesNotFallBackOnEmptyPrefixIfParameterPrefixIsProvided() - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/BindAttribute/" + - "BindParameterUsingParameterPrefix" + - "?Value=someValue"); - - // Assert - Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); - Assert.Equal(string.Empty, await response.Content.ReadAsStringAsync()); - } - - [Fact] - public async Task TryUpdateModel_IncludeTopLevelProperty_IncludesAllSubProperties() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetUserAsync_IncludesAllSubProperties" + - "?id=123&Key=34&RegistrationMonth=March&Address.Street=123&Address.Country.Name=USA&" + - "Address.State=WA&Address.Country.Cities[0].CityName=Seattle&Address.Country.Cities[0].CityCode=SEA"); - - // Assert - var user = JsonConvert.DeserializeObject(response); - - // Should update everything under Address. - Assert.Equal(123, user.Address.Street); // Included by default as sub properties are included. - Assert.Equal("WA", user.Address.State); // Included by default as sub properties of address are included. - Assert.Equal("USA", user.Address.Country.Name); // Included by default. - Assert.Equal("Seattle", user.Address.Country.Cities[0].CityName); // Included by default. - Assert.Equal("SEA", user.Address.Country.Cities[0].CityCode); // Included by default. - - // Should not update Any property at the same level as address. - // Key is id + 20. - Assert.Equal(143, user.Key); - Assert.Null(user.RegisterationMonth); - } - - [Fact] - public async Task TryUpdateModel_ChainedPropertyExpression_Throws() - { - // Arrange - Expression> expression = model => model.Address.Country; - var expected = string.Format( - "The passed expression of expression node type '{0}' is invalid." + - " Only simple member access expressions for model properties are supported.", - expression.Body.NodeType); - - // Act - var response = await Client.GetAsync( - "http://localhost/TryUpdateModel/GetUserAsync_WithChainedProperties?id=123"); - - // Assert - var exception = response.GetServerException(); - Assert.Equal(typeof(InvalidOperationException).FullName, exception.ExceptionType); - Assert.Equal(expected, exception.ExceptionMessage); - } - - [Fact] - public async Task TryUpdateModel_FailsToUpdateProperties() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "TryUpdateModelFails" + - "?id=123&RegisterationMonth=March&Key=123&UserName=SomeName"); - - // Assert - var result = JsonConvert.DeserializeObject(response); - Assert.False(result); - } - - [Fact] - public async Task TryUpdateModel_IncludeExpression_WorksOnlyAtTopLevel() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetPerson" + - "?Parent.Name=fatherName&Parent.Parent.Name=grandFatherName"); - - // Assert - var person = JsonConvert.DeserializeObject(response); - - // Act - Assert.Equal("fatherName", person.Parent.Name); - - // Includes this as there is data from value providers, the include filter - // only works for top level objects. - Assert.Equal("grandFatherName", person.Parent.Parent.Name); - } - - [Fact] - public async Task TryUpdateModel_Validates_ForTopLevelNotIncludedProperties() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "CreateAndUpdateUser" + - "?RegistedeburationMonth=March"); - - // Assert - var result = JsonConvert.DeserializeObject(response); - Assert.False(result); - } - - [Fact] - public async Task TryUpdateModelExcludeSpecific_Properties() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetUserAsync_ExcludeSpecificProperties" + - "?id=123&RegisterationMonth=March&Key=123&UserName=SomeName"); - - // Assert - var user = JsonConvert.DeserializeObject(response); - - // Should not update excluded properties. - Assert.NotEqual(123, user.Key); - - // Should Update all explicitly included properties. - Assert.Equal("March", user.RegisterationMonth); - Assert.Equal("SomeName", user.UserName); - } - - [Fact] - public async Task TryUpdateModelIncludeSpecific_Properties() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetUserAsync_IncludeSpecificProperties" + - "?id=123&RegisterationMonth=March&Key=123&UserName=SomeName"); - - // Assert - var user = JsonConvert.DeserializeObject(response); - - // Should not update any not explicitly mentioned properties. - Assert.NotEqual("SomeName", user.UserName); - Assert.NotEqual(123, user.Key); - - // Should Update all included properties. - Assert.Equal("March", user.RegisterationMonth); - } - - [Fact] - public async Task TryUpdateModelIncludesAllProperties_ByDefault() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetUserAsync_IncludeAllByDefault" + - "?id=123&RegisterationMonth=March&Key=123&UserName=SomeName"); - - // Assert - var user = JsonConvert.DeserializeObject(response); - - // Should not update any not explicitly mentioned properties. - Assert.Equal("SomeName", user.UserName); - Assert.Equal(123, user.Key); - - // Should Update all included properties. - Assert.Equal("March", user.RegisterationMonth); - } - - [Fact] - public async Task UpdateVehicle_WithJson_ProducesModelStateErrors() - { - // Arrange - var content = new - { - Year = 3012, - InspectedDates = new[] - { - new DateTime(4065, 10, 10) - }, - Make = "Volttrax", - Model = "Epsum" - }; - - // Act - var response = await Client.PutAsJsonAsync("http://localhost/api/vehicles/520", content); - - // Assert - Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var modelStateErrors = JsonConvert.DeserializeObject>>(body); - - Assert.Equal(2, modelStateErrors.Count); - // OrderBy is used because the order of the results may very depending on the platform / client. - Assert.Equal( - new[] - { - "The field Year must be between 1980 and 2034.", - "Year is invalid" - }, - modelStateErrors["Year"].OrderBy(item => item, StringComparer.Ordinal)); - - var vinError = Assert.Single(modelStateErrors["Vin"]); - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal(PlatformNormalizer.NormalizeContent("The Vin field is required."), vinError); - } - - [Fact] - public async Task UpdateVehicle_WithJson_DoesPropertyValidationPriorToValidationAtType() - { - // Arrange - var content = new - { - Year = 2007, - InspectedDates = new[] - { - new DateTime(4065, 10, 10) - }, - Make = "Volttrax", - Model = "Epsum", - Vin = "Pqrs" - }; - var request = new HttpRequestMessage(HttpMethod.Put, "http://localhost/api/vehicles/520"); - request.Content = new StringContent(JsonConvert.SerializeObject(content), Encoding.UTF8, "application/json"); - request.Headers.TryAddWithoutValidation("X-TrackingId", "trackingid"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var modelStateErrors = JsonConvert.DeserializeObject>>(body); - - var item = Assert.Single(modelStateErrors); - Assert.Equal("InspectedDates", item.Key); - var error = Assert.Single(item.Value); - Assert.Equal("Inspection date cannot be later than year of manufacture.", error); - } - - [Fact] - public async Task UpdateVehicle_WithJson_BindsBodyAndServices() - { - // Arrange - var trackingId = Guid.NewGuid().ToString(); - var postedContent = new - { - Year = 2010, - InspectedDates = new List - { - new DateTime(2008, 10, 01), - new DateTime(2009, 03, 01), - }, - Make = "Volttrax", - Model = "Epsum", - Vin = "PQRS" - }; - var request = new HttpRequestMessage(HttpMethod.Put, "http://localhost/api/vehicles/520"); - request.Content = new StringContent( - JsonConvert.SerializeObject(postedContent), - Encoding.UTF8, - "application/json"); - request.Headers.TryAddWithoutValidation("X-TrackingId", trackingId); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var actual = JsonConvert.DeserializeObject(body); - - Assert.Equal(postedContent.Vin, actual.Vin); - Assert.Equal(postedContent.Make, actual.Make); - Assert.Equal(postedContent.InspectedDates, actual.InspectedDates.Select(d => d.DateTime)); - Assert.Equal(trackingId, actual.LastUpdatedTrackingId); - } - -#if DNX451 - [ConditionalFact] - // Mono issue - https://github.com/aspnet/External/issues/18 - [FrameworkSkipCondition(RuntimeFrameworks.Mono)] - public async Task UpdateVehicle_WithXml_BindsBodyServicesAndHeaders() - { - // Arrange - var trackingId = Guid.NewGuid().ToString(); - var postedContent = new VehicleViewModel - { - Year = 2010, - InspectedDates = new DateTimeOffset[] - { - new DateTimeOffset(2008, 10, 01, 8, 3, 1, TimeSpan.Zero), - new DateTime(2009, 03, 01), - }, - Make = "Volttrax", - Model = "Epsum", - Vin = "PQRS" - }; - var request = new HttpRequestMessage(HttpMethod.Put, "http://localhost/api/vehicles/520"); - request.Content = new StringContent( - JsonConvert.SerializeObject(postedContent), - Encoding.UTF8, - "application/json"); - request.Headers.TryAddWithoutValidation("X-TrackingId", trackingId); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - var actual = JsonConvert.DeserializeObject(body); - - Assert.Equal(postedContent.Vin, actual.Vin); - Assert.Equal(postedContent.Make, actual.Make); - Assert.Equal(postedContent.InspectedDates, actual.InspectedDates); - Assert.Equal(trackingId, actual.LastUpdatedTrackingId); - } -#endif - - // Simulates a browser based client that does a Ajax post for partial page updates. - [Fact] - public async Task UpdateDealerVehicle_PopulatesPropertyErrorsInViews() - { - // Arrange - var outputFile = "compiler/resources/UpdateDealerVehicle_PopulatesPropertyErrorsInViews.txt"; - var expectedContent = await ResourceFile.ReadResourceAsync(_assembly, outputFile, sourceFile: false); - var postedContent = new - { - Year = 9001, - InspectedDates = new List - { - new DateTime(2008, 01, 01) - }, - Make = "Acme", - Model = "Epsum", - Vin = "LongerThan8Chars", - - }; - var url = "http://localhost/dealers/32/update-vehicle?dealer.name=TestCarDealer&dealer.location=SE"; - - // Act - var response = await Client.PostAsJsonAsync(url, postedContent); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent); -#else - // Mono issue - https://github.com/aspnet/External/issues/19 - expectedContent = PlatformNormalizer.NormalizeContent(expectedContent); - if (TestPlatformHelper.IsMono) - { - expectedContent = expectedContent.Replace( - "The field Year must be between 1980 and 2034.", - "Year is invalid"); - } - - Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true); -#endif - } - - [Fact] - public async Task UpdateDealerVehicle_PopulatesValidationSummary() - { - // Arrange - var outputFile = "compiler/resources/UpdateDealerVehicle_PopulatesValidationSummary.txt"; - var expectedContent = await ResourceFile.ReadResourceAsync(_assembly, outputFile, sourceFile: false); - var postedContent = new - { - Year = 2013, - InspectedDates = new List - { - new DateTime(2008, 01, 01) - }, - Make = "Acme", - Model = "Epsum", - Vin = "8chars", - - }; - var url = "http://localhost/dealers/43/update-vehicle?dealer.name=TestCarDealer&dealer.location=SE"; - - // Act - var response = await Client.PostAsJsonAsync(url, postedContent); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent); -#else - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal( - PlatformNormalizer.NormalizeContent(expectedContent), - responseContent, - ignoreLineEndingDifferences: true); -#endif - } - - [Fact] - public async Task UpdateDealerVehicle_UsesDefaultValuesForOptionalProperties() - { - // Arrange - var outputFile = "compiler/resources/UpdateDealerVehicle_UpdateSuccessful.txt"; - var expectedContent = await ResourceFile.ReadResourceAsync(_assembly, outputFile, sourceFile: false); - var postedContent = new - { - Year = 2013, - InspectedDates = new DateTimeOffset[] - { - new DateTimeOffset(new DateTime(2008, 11, 01), TimeSpan.FromHours(-7)) - }, - Make = "RealSlowCars", - Model = "Epsum", - Vin = "8chars", - - }; - var url = "http://localhost/dealers/43/update-vehicle?dealer.name=TestCarDealer&dealer.location=NE"; - - // Act - var response = await Client.PostAsJsonAsync(url, postedContent); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent); -#else - Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true); -#endif - } - - [Fact] - public async Task FormFileModelBinder_CanBind_SingleFile() - { - // Arrange - var url = "http://localhost/FileUpload/UploadSingle"; - var formData = new MultipartFormDataContent("Upload----"); - formData.Add(new StringContent("Test Content"), "file", "test.txt"); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var fileDetails = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.Equal("test.txt", fileDetails.Filename); - Assert.Equal("Test Content", fileDetails.Content); - } - - [Fact] - public async Task FormFileModelBinder_CanBind_MultipleFiles() - { - // Arrange - var url = "http://localhost/FileUpload/UploadMultiple"; - var formData = new MultipartFormDataContent("Upload----"); - formData.Add(new StringContent("Test Content 1"), "files", "test1.txt"); - formData.Add(new StringContent("Test Content 2"), "files", "test2.txt"); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var fileDetailsArray = JsonConvert.DeserializeObject( - await response.Content.ReadAsStringAsync()); - Assert.Equal(2, fileDetailsArray.Length); - Assert.Equal("test1.txt", fileDetailsArray[0].Filename); - Assert.Equal("Test Content 1", fileDetailsArray[0].Content); - Assert.Equal("test2.txt", fileDetailsArray[1].Filename); - Assert.Equal("Test Content 2", fileDetailsArray[1].Content); - } - - [Fact] - public async Task FormFileModelBinder_CanBind_MultipleListOfFiles() - { - // Arrange - var url = "http://localhost/FileUpload/UploadMultipleList"; - var formData = new MultipartFormDataContent("Upload----"); - formData.Add(new StringContent("Test Content 1"), "filelist1", "test1.txt"); - formData.Add(new StringContent("Test Content 2"), "filelist1", "test2.txt"); - formData.Add(new StringContent("Test Content 3"), "filelist2", "test3.txt"); - formData.Add(new StringContent("Test Content 4"), "filelist2", "test4.txt"); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var fileDetailsLookup = JsonConvert.DeserializeObject>>( - await response.Content.ReadAsStringAsync()); - Assert.Equal(2, fileDetailsLookup.Count); - var fileDetailsList1 = fileDetailsLookup["filelist1"]; - var fileDetailsList2 = fileDetailsLookup["filelist2"]; - Assert.Equal(2, fileDetailsList1.Count); - Assert.Equal(2, fileDetailsList2.Count); - Assert.Equal("test1.txt", fileDetailsList1[0].Filename); - Assert.Equal("Test Content 1", fileDetailsList1[0].Content); - Assert.Equal("test2.txt", fileDetailsList1[1].Filename); - Assert.Equal("Test Content 2", fileDetailsList1[1].Content); - Assert.Equal("test3.txt", fileDetailsList2[0].Filename); - Assert.Equal("Test Content 3", fileDetailsList2[0].Content); - Assert.Equal("test4.txt", fileDetailsList2[1].Filename); - Assert.Equal("Test Content 4", fileDetailsList2[1].Content); - } - - [Fact] - public async Task FormFileModelBinder_CanBind_FileInsideModel() - { - // Arrange - var url = "http://localhost/FileUpload/UploadModelWithFile"; - var formData = new MultipartFormDataContent("Upload----"); - formData.Add(new StringContent("Test Book"), "Name"); - formData.Add(new StringContent("Test Content"), "File", "test.txt"); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var book = JsonConvert.DeserializeObject>( - await response.Content.ReadAsStringAsync()); - var bookName = book.Key; - var fileDetails = book.Value; - Assert.Equal("Test Book", bookName); - Assert.Equal("test.txt", fileDetails.Filename); - Assert.Equal("Test Content", fileDetails.Content); - } - - [Fact] - public async Task TryUpdateModel_ReturnDerivedAndBaseProperties() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetEmployeeAsync_BindToBaseDeclaredType" + - "?Parent.Name=fatherName&Parent.Parent.Name=grandFatherName&Department=Sales"); - - // Assert - var employee = JsonConvert.DeserializeObject(response); - Assert.Equal("fatherName", employee.Parent.Name); - Assert.Equal("Sales", employee.Department); - - // Round-tripped value includes descendent instances for all properties with data in the request. - Assert.Equal("grandFatherName", employee.Parent.Parent.Name); - } - - [Fact] - public async Task HtmlHelper_DisplayFor_ShowsPropertiesInModelMetadataOrder() - { - // Arrange - var outputFile = "compiler/resources/ModelBindingWebSite.Vehicle.Details.html"; - var expectedContent = await ResourceFile.ReadResourceAsync(_assembly, outputFile, sourceFile: false); - var url = "http://localhost/vehicles/42"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent); -#else - Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true); -#endif - } - - [Fact] - public async Task HtmlHelper_EditorFor_ShowsPropertiesInModelMetadataOrder() - { - // Arrange - var outputFile = "compiler/resources/ModelBindingWebSite.Vehicle.Edit.html"; - var expectedContent = await ResourceFile.ReadResourceAsync(_assembly, outputFile, sourceFile: false); - var url = "http://localhost/vehicles/42/edit"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent); -#else - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal( - PlatformNormalizer.NormalizeContent(expectedContent), - responseContent, - ignoreLineEndingDifferences: true); -#endif - } - - [Fact] - public async Task HtmlHelper_EditorFor_ShowsPropertiesAndErrorsInModelMetadataOrder() - { - // Arrange - var outputFile = "compiler/resources/ModelBindingWebSite.Vehicle.Edit.Invalid.html"; - var expectedContent = await ResourceFile.ReadResourceAsync(_assembly, outputFile, sourceFile: false); - var url = "http://localhost/vehicles/42/edit"; - var contentDictionary = new Dictionary - { - { "Make", "Fast Cars" }, - { "Model", "the Fastener" }, - { "InspectedDates[0]", "14/10/1979 00:00:00 -08:00" }, - { "InspectedDates[1]", "16/10/1979 00:00:00 -08:00" }, - { "InspectedDates[2]", "02/11/1979 00:00:00 -08:00" }, - { "InspectedDates[3]", "13/11/1979 00:00:00 -08:00" }, - { "InspectedDates[4]", "05/12/1979 00:00:00 -08:00" }, - { "InspectedDates[5]", "12/12/1979 00:00:00 -08:00" }, - { "InspectedDates[6]", "19/12/1979 00:00:00 -08:00" }, - { "InspectedDates[7]", "26/12/1979 00:00:00 -08:00" }, - { "InspectedDates[8]", "28/12/1979 00:00:00 -08:00" }, - { "InspectedDates[9]", "29/12/1979 00:00:00 -08:00" }, - { "InspectedDates[10]", "01/04/1980 00:00:00 -08:00" }, - { "Vin", "8765432112345678" }, - { "Year", "1979" }, - }; - var requestContent = new FormUrlEncodedContent(contentDictionary); - - // Act - var response = await Client.PostAsync(url, requestContent); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var responseContent = await response.Content.ReadAsStringAsync(); -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent); -#else - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal( - PlatformNormalizer.NormalizeContent(expectedContent), - responseContent, - ignoreLineEndingDifferences: true); -#endif - } - - [Fact] - public async Task ModelBinder_FormatsDontMatch_ThrowsUserFriendlyException() - - { - // Arrange - var url = "http://localhost/Home/GetErrorMessage"; - - var nameValueCollection = new List> - { - new KeyValuePair("birthdate", "random string"), - }; - var formData = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var result = await response.Content.ReadAsStringAsync(); - Assert.Equal("The value 'random string' is not valid for DateTime.", result); - } - - [Fact] - public async Task OverriddenMetadataProvider_CanChangeAdditionalValues() - { - // Arrange - var url = "http://localhost/AdditionalValues"; - var expectedDictionary = new Dictionary - { - { "key1", "7d6d0de2-8d59-49ac-99cc-881423b75a76" }, - { "key2", "value2" }, - }; - - // Act - var response = await Client.GetAsync(url); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var responseContent = await response.Content.ReadAsStringAsync(); - var dictionary = JsonConvert.DeserializeObject>(responseContent); - Assert.Equal(expectedDictionary, dictionary); - } - - [Fact] - public async Task OverriddenMetadataProvider_CanUseAttributesToChangeAdditionalValues() - { - // Arrange - var url = "http://localhost/GroupNames"; - var expectedDictionary = new Dictionary - { - { "Model", "MakeAndModelGroup" }, - { "Make", "MakeAndModelGroup" }, - { "Vin", null }, - { "Year", null }, - { "InspectedDates", null }, - { "LastUpdatedTrackingId", "TrackingIdGroup" }, - }; - - // Act - var response = await Client.GetAsync(url); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var responseContent = await response.Content.ReadAsStringAsync(); - var dictionary = JsonConvert.DeserializeObject>(responseContent); - Assert.Equal(expectedDictionary, dictionary); - } - - [Fact] - public async Task TryUpdateModelNonGeneric_IncludesAllProperties_CanBind() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetUserAsync_ModelType_IncludeAll" + - "?id=123&RegisterationMonth=March&Key=123&UserName=SomeName"); - - // Assert - var user = JsonConvert.DeserializeObject(response); - - // Should not update any not explicitly mentioned properties. - Assert.Equal("SomeName", user.UserName); - Assert.Equal(123, user.Key); - - // Should Update all included properties. - Assert.Equal("March", user.RegisterationMonth); - } - - [Fact] - public async Task FormCollectionModelBinder_CanBind_FormValues() - { - // Arrange - var url = "http://localhost/FormCollection/ReturnValuesAsList"; - var nameValueCollection = new List> - { - new KeyValuePair("field1", "value1"), - new KeyValuePair("field2", "value2"), - }; - var formData = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var valuesList = JsonConvert.DeserializeObject>(await response.Content.ReadAsStringAsync()); - Assert.Equal(new List { "value1", "value2" }, valuesList); - } - - [Fact] - public async Task FormCollectionModelBinder_CanBind_FormValuesWithDuplicateKeys() - { - // Arrange - var url = "http://localhost/FormCollection/ReturnValuesAsList"; - var nameValueCollection = new List> - { - new KeyValuePair("field1", "value1"), - new KeyValuePair("field2", "value2"), - new KeyValuePair("field1", "value3"), - }; - var formData = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var valuesList = JsonConvert.DeserializeObject>(await response.Content.ReadAsStringAsync()); - Assert.Equal(new List { "value1,value3", "value2" }, valuesList); - } - - [Fact] - public async Task FormCollectionModelBinder_CannotBind_NonFormValues() - { - // Arrange - var url = "http://localhost/FormCollection/ReturnCollectionCount"; - var data = new StringContent("Non form content"); - - // Act - var response = await Client.PostAsync(url, data); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var collectionCount = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - Assert.Equal(0, collectionCount); - } - - [Fact] - public async Task FormCollectionModelBinder_CanBind_FormWithFile() - { - // Arrange - var url = "http://localhost/FormCollection/ReturnFileContent"; - var expectedContent = "Test Content"; - var formData = new MultipartFormDataContent("Upload----"); - formData.Add(new StringContent(expectedContent), "File", "test.txt"); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var fileContent = await response.Content.ReadAsStringAsync(); - Assert.Equal(expectedContent, fileContent); - } - - [Fact] - public async Task TryUpdateModelNonGenericIncludesAllProperties_ByDefault() - { - // Arrange & Act - var response = await Client.GetStringAsync("http://localhost/TryUpdateModel/" + - "GetUserAsync_ModelType_IncludeAllByDefault" + - "?id=123&RegisterationMonth=March&Key=123&UserName=SomeName"); - - // Assert - var user = JsonConvert.DeserializeObject(response); - - // Should not update any not explicitly mentioned properties. - Assert.Equal("SomeName", user.UserName); - Assert.Equal(123, user.Key); - - // Should Update all included properties. - Assert.Equal("March", user.RegisterationMonth); - } - - [Fact] - public async Task BindModelAsync_WithCollection() - { - // Arrange - var content = new Dictionary - { - { "AddressLines[0].Line", "Street Address 0" }, - { "AddressLines[1].Line", "Street Address 1" }, - { "ZipCode", "98052" }, - }; - var url = "http://localhost/Person_CollectionBinder/CollectionType"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PutAsync(url, formData); - - // Assert - var address = await ReadValue(response); - Assert.Equal(2, address.AddressLines.Count); - Assert.Equal("Street Address 0", address.AddressLines[0].Line); - Assert.Equal("Street Address 1", address.AddressLines[1].Line); - Assert.Equal("98052", address.ZipCode); - } - - [Fact] - public async Task BindModelAsync_WithCollection_SpecifyingIndex() - { - // Arrange - var content = new[] - { - new KeyValuePair("AddressLines.index", "3"), - new KeyValuePair("AddressLines.index", "10000"), - new KeyValuePair("AddressLines[3].Line", "Street Address 0"), - new KeyValuePair("AddressLines[10000].Line", "Street Address 1"), - }; - var url = "http://localhost/Person_CollectionBinder/CollectionType"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PutAsync(url, formData); - - // Assert - var address = await ReadValue(response); - Assert.Equal(2, address.AddressLines.Count); - Assert.Equal("Street Address 0", address.AddressLines[0].Line); - Assert.Equal("Street Address 1", address.AddressLines[1].Line); - } - - [Fact] - public async Task BindModelAsync_WithNestedCollection() - { - // Arrange - var content = new Dictionary - { - { "Addresses[0].AddressLines[0].Line", "Street Address 00" }, - { "Addresses[0].AddressLines[1].Line", "Street Address 01" }, - { "Addresses[0].ZipCode", "98052" }, - { "Addresses[1].AddressLines[0].Line", "Street Address 10" }, - { "Addresses[1].AddressLines[3].Line", "Street Address 13" }, - }; - var url = "http://localhost/Person_CollectionBinder/NestedCollectionType"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - var result = await ReadValue(response); - Assert.Equal(2, result.Addresses.Count); - var address = result.Addresses[0]; - Assert.Equal(2, address.AddressLines.Count); - Assert.Equal("Street Address 00", address.AddressLines[0].Line); - Assert.Equal("Street Address 01", address.AddressLines[1].Line); - Assert.Equal("98052", address.ZipCode); - - address = result.Addresses[1]; - Assert.Single(address.AddressLines); - Assert.Equal("Street Address 10", address.AddressLines[0].Line); - Assert.Null(address.ZipCode); - } - - [Fact] - public async Task BindModelAsync_WithIncorrectlyFormattedNestedCollectionValue_BindsSingleNullEntry() - { - // Arrange - var content = new Dictionary - { - { "Addresses", "Street Address 00" }, - }; - var url = "http://localhost/Person_CollectionBinder/NestedCollectionType"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - var result = await ReadValue(response); - Assert.Empty(result.Addresses); - } - - [Fact] - public async Task BindModelAsync_WithNestedCollectionContainingRecursiveRelation() - { - // Arrange - var content = new Dictionary - { - { "People[0].Name", "Person 0" }, - { "People[0].Parent.Name", "Person 0 Parent" }, - { "People[1].Parent.Name", "Person 1 Parent" }, - { "People[2].Parent", "Person 2 Parent" }, - { "People[1000].Name", "Person 1000 Parent" }, - }; - var url = "http://localhost/Person_CollectionBinder/NestedCollectionOfRecursiveTypes"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - var result = await ReadValue(response); - Assert.Equal(3, result.People.Count); - var person = result.People[0]; - - Assert.Equal("Person 0", person.Name); - Assert.Equal("Person 0 Parent", person.Parent.Name); - Assert.Null(person.Parent.Parent); - - person = result.People[1]; - Assert.Equal("Person 1 Parent", person.Parent.Name); - Assert.Null(person.Parent.Parent); - - person = result.People[2]; - Assert.Null(person.Name); - Assert.Null(person.Parent); - } - - [Fact] - public async Task - BindModelAsync_WithNestedCollectionContainingRecursiveRelation_WithMalformedValue_BindsSingleNullEntry() - { - // Arrange - var content = new Dictionary - { - { "People", "Person 0" }, - }; - var url = "http://localhost/Person_CollectionBinder/NestedCollectionOfRecursiveTypes"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - var result = await ReadValue(response); - - Assert.Empty(result.People); - } - - [Theory] - [InlineData("true", "false", true)] - [InlineData("false", "true", false)] - public async Task BindModelAsync_MultipleCheckBoxesWithSameKey_BindsFirstValue(string firstValue, - string secondValue, - bool expectedResult) - { - // Arrange - var content = new List> - { - new KeyValuePair("isValid", firstValue), - new KeyValuePair("isValid", secondValue), - }; - var url = "http://localhost/Person_CollectionBinder/PostCheckBox"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - var result = await ReadValue(response); - Assert.Equal(expectedResult, result); - } - - [Fact] - public async Task BindModelAsync_CheckBoxesList_BindSuccessful() - { - // Arrange - var content = new List> - { - new KeyValuePair("userPreferences[0].Id", "1"), - new KeyValuePair("userPreferences[0].Checked", "true"), - new KeyValuePair("userPreferences[1].Id", "2"), - new KeyValuePair("userPreferences[1].Checked", "false"), - }; - var url = "http://localhost/Person_CollectionBinder/PostCheckBoxList"; - var formData = new FormUrlEncodedContent(content); - - // Act - var response = await Client.PostAsync(url, formData); - - // Assert - var result = await ReadValue>(response); - Assert.True(result[0].Checked); - Assert.False(result[1].Checked); - } - - [Fact] - public async Task TryUpdateModel_ClearsModelStateEntries() - { - // Arrange - var url = "http://localhost/TryUpdateModel/TryUpdateModel_ClearsModelStateEntries"; - - // Act - var response = await Client.GetAsync(url); - - // Assert - Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); - var body = await response.Content.ReadAsStringAsync(); - Assert.Equal(string.Empty, body); - } - - private async Task ReadValue(HttpResponseMessage response) - { - Assert.True(response.IsSuccessStatusCode); - return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - } - } -} diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/RazorEmbeddedViewsTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/RazorEmbeddedViewsTest.cs deleted file mode 100644 index a7bf7385d..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/RazorEmbeddedViewsTest.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Net.Http; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class RazorEmbeddedViewsTest : IClassFixture> - { - public RazorEmbeddedViewsTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task RazorViewEngine_UsesFileProviderOnViewEngineOptionsToLocateViews() - { - // Arrange - var expectedMessage = "Hello test-user, this is /RazorEmbeddedViews_Home"; - - // Act - var response = await Client.GetStringAsync("http://localhost/RazorEmbeddedViews_Home?User=test-user"); - - // Assert - Assert.Equal(expectedMessage, response); - } - - [Fact] - public async Task RazorViewEngine_UsesFileProviderOnViewEngineOptionsToLocateAreaViews() - { - // Arrange - var expectedMessage = "Hello admin-user, this is /Restricted/RazorEmbeddedViews_Admin/Login"; - var target = "http://localhost/Restricted/RazorEmbeddedViews_Admin/Login?AdminUser=admin-user"; - - // Act - var response = await Client.GetStringAsync(target); - - // Assert - Assert.Equal(expectedMessage, response); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/RoundTripTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/RoundTripTests.cs deleted file mode 100644 index 15a7c26ad..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/RoundTripTests.cs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; -using ModelBindingWebSite.Models; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - /// - /// Functional tests that verify if names returned by HtmlHelper.NameFor get model bound correctly. - /// Each test works in three steps - - /// 1) The result of an HtmlHelper.NameFor invocation for a specific expression is retrieved. - /// 2) A form URL encoded value is posted for the retrieved name. - /// 3) The server returns the bound object. We verify if the property specified by the expression in step 1 - /// has the expected value. - /// - public class RoundTripTests : IClassFixture> - { - public RoundTripTests(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task RoundTrippedValues_GetsModelBound_ForSimpleExpressions() - { - // Arrange - var expected = "test-name"; - - // Act - var expression = await Client.GetStringAsync("http://localhost/RoundTrip/GetPerson"); - var keyValuePairs = new[] - { - new KeyValuePair(expression, expected) - }; - var result = await GetPerson(Client, keyValuePairs); - - // Assert - Assert.Equal("Name", expression); - Assert.Equal(expected, result.Name); - } - - // Uses the expression p => p.Parent.Age - [Fact] - public async Task RoundTrippedValues_GetsModelBound_ForSubPropertyExpressions() - { - // Arrange - var expected = 40; - - // Act - var expression = await Client.GetStringAsync("http://localhost/RoundTrip/GetPersonParentAge"); - var keyValuePairs = new[] - { - new KeyValuePair(expression, expected.ToString()) - }; - var result = await GetPerson(Client, keyValuePairs); - - // Assert - Assert.Equal("Parent.Age", expression); - Assert.Equal(expected, result.Parent.Age); - } - - // Uses the expression p => p.Dependents[0].Age - [Fact] - public async Task RoundTrippedValues_GetsModelBound_ForNumericIndexedProperties() - { - // Arrange - var expected = 12; - - // Act - var expression = await Client.GetStringAsync("http://localhost/RoundTrip/GetPersonDependentAge"); - var keyValuePairs = new[] - { - new KeyValuePair(expression, expected.ToString()) - }; - var result = await GetPerson(Client, keyValuePairs); - - // Assert - Assert.Equal("Dependents[0].Age", expression); - Assert.Equal(expected, result.Dependents[0].Age); - } - - // Uses the expression p => p.Parent.Attributes["height"] - [Fact] - public async Task RoundTrippedValues_GetsModelBound_ForStringIndexedProperties() - { - // Arrange - var expected = "6 feet"; - - // Act - var expression = await Client.GetStringAsync("http://localhost/RoundTrip/GetPersonParentHeightAttribute"); - var keyValuePairs = new[] - { - new KeyValuePair(expression, expected), - }; - var result = await GetPerson(Client, keyValuePairs); - - // Assert - Assert.Equal("Parent.Attributes[height]", expression); - Assert.Equal(expected, result.Parent.Attributes["height"]); - } - - // Uses the expression p => p.Dependents[0].Dependents[0].Name - [Fact] - public async Task RoundTrippedValues_GetsModelBound_ForNestedNumericIndexedProperties() - { - // Arrange - var expected = "test-nested-name"; - - // Act - var expression = await Client.GetStringAsync("http://localhost/RoundTrip/GetDependentPersonName"); - var keyValuePairs = new[] - { - new KeyValuePair(expression, expected.ToString()) - }; - var result = await GetPerson(Client, keyValuePairs); - - // Assert - Assert.Equal("Dependents[0].Dependents[0].Name", expression); - Assert.Equal(expected, result.Dependents[0].Dependents[0].Name); - } - - private static async Task GetPerson(HttpClient client, KeyValuePair[] keyValuePairs) - { - var content = new FormUrlEncodedContent(keyValuePairs); - var response = await client.PostAsync("http://localhost/RoundTrip/Person", content); - var result = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - return result; - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/RoutingLowercaseUrlTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/RoutingLowercaseUrlTest.cs deleted file mode 100644 index fd8676835..000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/RoutingLowercaseUrlTest.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - // This website sets the generation of lowercase URLs to true - public class RoutingLowercaseUrlTest : IClassFixture> - { - public RoutingLowercaseUrlTest(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Theory] - // Generating lower case URL doesnt lowercase the query parameters - [InlineData("LowercaseUrls_Blog/Generatelink", "/api/employee/getemployee/marykae?LastName=McDonald")] - - // Lowercasing controller and action for conventional route - [InlineData("LowercaseUrls_Blog/ShowPosts", "/lowercaseurls_blog/showposts")] - - // Lowercasing controller, action and other route data for conventional route - [InlineData("LowercaseUrls_Blog/edit/BlogPost", "/lowercaseurls_blog/edit/blogpost")] - - // Lowercasing controller and action for attribute route - [InlineData("Api/Employee/List", "/api/employee/list")] - - // Lowercasing controller, action and other route data for attribute route - [InlineData("Api/Employee/GetEmployee/JohnDoe", "/api/employee/getemployee/johndoe")] - public async Task GenerateLowerCaseUrlsTests(string path, string expectedUrl) - { - // Arrange & Act - var response = await Client.GetAsync("http://localhost/" + path); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - var body = await response.Content.ReadAsStringAsync(); - Assert.Equal(expectedUrl, body); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json index 194c5ac58..11e23c75c 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json @@ -8,30 +8,26 @@ }, "dependencies": { "ActionConstraintsWebSite": "1.0.0", - "ActionResultsWebSite": "1.0.0", - "ActivatorWebSite": "1.0.0", "AntiforgeryTokenWebSite": "1.0.0", "ApiExplorerWebSite": "1.0.0", "ApplicationModelWebSite": "1.0.0", "BasicWebSite": "1.0.0", "CompositeViewEngineWebSite": "1.0.0", "ContentNegotiationWebSite": "1.0.0", - "ControllerDiscoveryConventionsWebSite": "1.0.0", "ControllersFromServicesWebSite": "1.0.0", "CorsMiddlewareWebSite": "1.0.0", "CorsWebSite": "1.0.0", - "CustomRouteWebSite": "1.0.0", + "CustomRouteSample.Web": "1.0.0", + "EmbeddedViewSample.Web": "1.0.0", "ErrorPageMiddlewareWebSite": "1.0.0", "FilesWebSite": "1.0.0", "FiltersWebSite": "1.0.0", - "FormatFilterWebSite": "1.0.0-*", + "FormatFilterSample.Web": "1.0.0-*", "FormatterWebSite": "1.0.0", "HtmlGenerationWebSite": "1.0.0", - "InlineConstraintsWebSite": "1.0.0", - "JsonPatchWebSite": "1.0.0", - "LocalizationWebSite": "1.0.0", - "LoggingWebSite": "1.0.0", - "LowercaseUrlsWebSite": "1.0.0-*", + "InlineConstraintSample.Web": "1.0.0", + "JsonPatchSample.Web": "1.0.0", + "LocalizationSample.Web": "1.0.0", "Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*", "Microsoft.AspNet.Mvc.TestCommon": { @@ -43,10 +39,8 @@ "Microsoft.AspNet.WebUtilities": "1.0.0-*", "Microsoft.Extensions.Configuration.Json": "1.0.0-*", "Microsoft.Extensions.Logging.Testing": "1.0.0-*", - "ModelBindingWebSite": "1.0.0", "MvcSandbox": "1.0.0", "PrecompilationWebSite": "1.0.0", - "RazorEmbeddedViewsWebSite": "1.0.0", "RazorPageExecutionInstrumentationWebSite": "1.0.0", "RazorWebSite": "1.0.0", "RoutingWebSite": "1.0.0", diff --git a/test/WebSites/ActionResultsWebSite/ActionResultsWebSite.xproj b/test/WebSites/ActionResultsWebSite/ActionResultsWebSite.xproj deleted file mode 100644 index 894f19615..000000000 --- a/test/WebSites/ActionResultsWebSite/ActionResultsWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 0a6bb4c0-48d3-4e7f-952b-b8917345e075 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 41642 - - - \ No newline at end of file diff --git a/test/WebSites/ActionResultsWebSite/Controllers/ActionResultsVerificationController.cs b/test/WebSites/ActionResultsWebSite/Controllers/ActionResultsVerificationController.cs deleted file mode 100644 index d55cc4480..000000000 --- a/test/WebSites/ActionResultsWebSite/Controllers/ActionResultsVerificationController.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Text; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; - -namespace ActionResultsWebSite -{ - public class ActionResultsVerificationController : Controller - { - public ActionResultsVerificationController(GuidLookupService guidLookupService) - { - GuidLookupService = guidLookupService; - } - - public GuidLookupService GuidLookupService { get; } - - public IActionResult Index([FromBody]DummyClass test) - { - if (!ModelState.IsValid) - { - return new BadRequestResult(); - } - - return Content("Hello World!"); - } - - public IActionResult GetBadResult() - { - return new BadRequestResult(); - } - - public IActionResult GetCreatedRelative() - { - return Created("1", CreateDummy()); - } - - public IActionResult GetCreatedAbsolute() - { - return Created("/ActionResultsVerification/GetDummy/1", CreateDummy()); - } - - public IActionResult GetCreatedQualified() - { - return Created("http://localhost/ActionResultsVerification/GetDummy/1", CreateDummy()); - } - - public IActionResult GetCreatedUri() - { - return Created(new Uri("/ActionResultsVerification/GetDummy/1", UriKind.Relative), CreateDummy()); - } - - public IActionResult GetCreatedAtAction() - { - var values = new { id = 1 }; - return CreatedAtAction("GetDummy", "ActionResultsVerification", values, CreateDummy()); - } - - public IActionResult GetCreatedAtRoute() - { - var values = new { controller = "ActionResultsVerification", Action = "GetDummy", id = 1 }; - return CreatedAtRoute(null, values, CreateDummy()); - } - - public IActionResult GetCreatedAtRouteWithRouteName() - { - var values = new { controller = "ActionResultsVerification", Action = "GetDummy", id = 1 }; - return CreatedAtRoute("custom-route", values, CreateDummy()); - } - - public IActionResult GetContentResult() - { - return Content("content"); - } - - public IActionResult GetContentResultWithContentType() - { - return Content("content", "application/json"); - } - - public IActionResult GetContentResultWithContentTypeAndEncoding() - { - return Content("content", "application/json", Encoding.ASCII); - } - - public IActionResult GetObjectResultWithNoContent() - { - var result = new ObjectResult(null); - result.StatusCode = StatusCodes.Status201Created; - return result; - } - - public IActionResult GetNotFoundObjectResult() - { - return HttpNotFound(null); - } - - public IActionResult GetNotFoundObjectResultWithContent() - { - return HttpNotFound(CreateDummy()); - } - - public IActionResult GetNotFoundObjectResultWithDisposableObject(string guid) - { - return HttpNotFound(CreateDisposableType(guid)); - } - - public bool GetDisposeCalled(string guid) - { - bool value; - if (GuidLookupService.IsDisposed.TryGetValue(guid, out value)) - { - return value; - } - - return false; - } - - public DummyClass GetDummy(int id) - { - return CreateDummy(); - } - - private DummyClass CreateDummy() - { - return new DummyClass() - { - SampleInt = 10, - SampleString = "Foo" - }; - } - - private DisposableType CreateDisposableType(string guid) - { - return new DisposableType(GuidLookupService, guid); - } - - private class DisposableType : IDisposable - { - private GuidLookupService _service; - private string _guid; - - public DisposableType(GuidLookupService service, string guid) - { - _service = service; - _guid = guid; - _service.IsDisposed[_guid] = false; - } - - public void Dispose() - { - _service.IsDisposed[_guid] = true; - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActionResultsWebSite/Controllers/HomeController.cs b/test/WebSites/ActionResultsWebSite/Controllers/HomeController.cs deleted file mode 100644 index 5f3dbe606..000000000 --- a/test/WebSites/ActionResultsWebSite/Controllers/HomeController.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNet.Mvc; - -namespace ActionResultsWebSite -{ - public class HomeController : Controller - { - public IActionResult Index([FromBody] DummyClass test) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - return Content("Hello World!"); - } - - public IActionResult GetCustomErrorObject([FromBody] DummyClass test) - { - if (!ModelState.IsValid) - { - var errors = new List(); - errors.Add("Something went wrong with the model."); - return new BadRequestObjectResult(errors); - } - - return Content("Hello World!"); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActionResultsWebSite/Controllers/XmlSerializerController.cs b/test/WebSites/ActionResultsWebSite/Controllers/XmlSerializerController.cs deleted file mode 100644 index 43ccd38c0..000000000 --- a/test/WebSites/ActionResultsWebSite/Controllers/XmlSerializerController.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Filters; -using Microsoft.AspNet.Mvc.Formatters; - -namespace ActionResultsWebSite -{ - public class XmlSerializerController : Controller - { - public IActionResult GetSerializableError([FromBody] DummyClass test) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - return Content("Success!"); - } - - public override void OnActionExecuted(ActionExecutedContext context) - { - var result = context.Result as ObjectResult; - if (result != null) - { - result.Formatters.Add(new XmlSerializerOutputFormatter()); - } - - base.OnActionExecuted(context); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActionResultsWebSite/GuidLookupService.cs b/test/WebSites/ActionResultsWebSite/GuidLookupService.cs deleted file mode 100644 index 28af6f571..000000000 --- a/test/WebSites/ActionResultsWebSite/GuidLookupService.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace ActionResultsWebSite -{ - public class GuidLookupService - { - public Dictionary IsDisposed { get; } = new Dictionary(); - } -} \ No newline at end of file diff --git a/test/WebSites/ActionResultsWebSite/Models/DummyClass.cs b/test/WebSites/ActionResultsWebSite/Models/DummyClass.cs deleted file mode 100644 index 481bc53bc..000000000 --- a/test/WebSites/ActionResultsWebSite/Models/DummyClass.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace ActionResultsWebSite -{ - public class DummyClass - { - [Range(10, 100)] - public int SampleInt { get; set; } - - [MinLength(15)] - public string SampleString { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ActionResultsWebSite/Startup.cs b/test/WebSites/ActionResultsWebSite/Startup.cs deleted file mode 100644 index c556bf0e1..000000000 --- a/test/WebSites/ActionResultsWebSite/Startup.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Mvc; -using Microsoft.Extensions.DependencyInjection; - -namespace ActionResultsWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services - .AddMvc() - .AddXmlDataContractSerializerFormatters(); - - services.AddSingleton(new GuidLookupService()); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseMvc(routes => - { - routes.MapRoute( - name: "default", - template: "{controller}/{action}/{id?}", - defaults: new { controller = "ActionResultsVerification", action = "Index" }); - - routes.MapRoute( - name: "custom-route", - template: "foo/{controller}/{action}/{id?}"); - }); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActionResultsWebSite/project.json b/test/WebSites/ActionResultsWebSite/project.json deleted file mode 100644 index 47c7af0a1..000000000 --- a/test/WebSites/ActionResultsWebSite/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/ActionResultsWebSite/readme.md b/test/WebSites/ActionResultsWebSite/readme.md deleted file mode 100644 index a00459f9b..000000000 --- a/test/WebSites/ActionResultsWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -ActionResultsWebSite -=== - -This web site illustrates how to use out of box action results which are provided as methods on the controller class. diff --git a/test/WebSites/ActionResultsWebSite/wwwroot/HelloWorld.htm b/test/WebSites/ActionResultsWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/ActionResultsWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/ActivatorWebSite/ActivatorWebSite.xproj b/test/WebSites/ActivatorWebSite/ActivatorWebSite.xproj deleted file mode 100644 index effcaa143..000000000 --- a/test/WebSites/ActivatorWebSite/ActivatorWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - db79bcba-9538-4a53-87d9-77728e2baa39 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 49622 - - - \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Components/CannotBeActivatedComponent.cs b/test/WebSites/ActivatorWebSite/Components/CannotBeActivatedComponent.cs deleted file mode 100644 index 16854989a..000000000 --- a/test/WebSites/ActivatorWebSite/Components/CannotBeActivatedComponent.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ActivatorWebSite -{ - [ViewComponent(Name = "CannotBeActivated")] - public class CannotBeActivatedComponent : ViewComponent - { - public CannotBeActivatedComponent(FakeType fakeType) - { - } - - public IViewComponentResult Invoke() - { - return Content("Test"); - } - - public sealed class FakeType - { - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Components/NumberComponent.cs b/test/WebSites/ActivatorWebSite/Components/NumberComponent.cs deleted file mode 100644 index 7be9b414c..000000000 --- a/test/WebSites/ActivatorWebSite/Components/NumberComponent.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ActivatorWebSite -{ - [ViewComponent(Name = "Number")] - public class NumberComponent : ViewComponent - { - public NumberComponent(MyService myTestService) - { - MyTestService = myTestService; - } - - private MyService MyTestService { get; } - - public IViewComponentResult Invoke(string content) - { - return Content(content + ":" + MyTestService.Random); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Components/TestComponent.cs b/test/WebSites/ActivatorWebSite/Components/TestComponent.cs deleted file mode 100644 index 8e84d3cdb..000000000 --- a/test/WebSites/ActivatorWebSite/Components/TestComponent.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ActivatorWebSite -{ - [ViewComponent(Name = "Test")] - public class TestComponent : ViewComponent - { - public IViewComponentResult Invoke(string content) - { - return Content(content + "!"); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Controllers/CannotBeActivatedController.cs b/test/WebSites/ActivatorWebSite/Controllers/CannotBeActivatedController.cs deleted file mode 100644 index a8d241359..000000000 --- a/test/WebSites/ActivatorWebSite/Controllers/CannotBeActivatedController.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ActivatorWebSite -{ - public class CannotBeActivatedController - { - public CannotBeActivatedController(FakeType service) - { - } - - public IActionResult Index() - { - return new NoContentResult(); - } - - public sealed class FakeType - { - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Controllers/PlainController.cs b/test/WebSites/ActivatorWebSite/Controllers/PlainController.cs deleted file mode 100644 index 8dfe1a41e..000000000 --- a/test/WebSites/ActivatorWebSite/Controllers/PlainController.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; - -namespace ActivatorWebSite -{ - public class PlainController - { - [ActionContext] - public ActionContext ActionContext { get; set; } - - public HttpRequest Request => ActionContext.HttpContext.Request; - - public HttpResponse Response => ActionContext.HttpContext.Response; - - public IActionResult Index([FromServices] MyService service) - { - Response.Headers["X-Fake-Header"] = "Fake-Value"; - - var value = Request.Query["foo"]; - return new ContentResult { Content = service.Random + "|" + value }; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Controllers/RegularController.cs b/test/WebSites/ActivatorWebSite/Controllers/RegularController.cs deleted file mode 100644 index 79b0c24c3..000000000 --- a/test/WebSites/ActivatorWebSite/Controllers/RegularController.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Threading.Tasks; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; - -namespace ActivatorWebSite -{ - public class RegularController : Controller - { - public async Task Index() - { - // This verifies that ModelState and Context are activated. - if (ModelState.IsValid) - { - await HttpContext.Response.WriteAsync("Hello world"); - } - - return new EmptyResult(); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Controllers/ViewController.cs b/test/WebSites/ActivatorWebSite/Controllers/ViewController.cs deleted file mode 100644 index 16540b374..000000000 --- a/test/WebSites/ActivatorWebSite/Controllers/ViewController.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using ActivatorWebSite.Models; -using Microsoft.AspNet.Mvc; - -namespace ActivatorWebSite -{ - /// - /// Controller that verifies if view activation works. - /// - public class ViewController : Controller - { - public IActionResult ConsumeDefaultProperties() - { - return View(); - } - - public IActionResult ConsumeInjectedService() - { - return View(); - } - - public IActionResult ConsumeServicesFromBaseType() - { - return View(); - } - - public IActionResult ConsumeViewComponent() - { - return View(); - } - - public IActionResult ConsumeCannotBeActivatedComponent() - { - return View(); - } - - public IActionResult UseTagHelper() - { - var item = new Item - { - Name = "Fake" - }; - return View(item); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Models/Item.cs b/test/WebSites/ActivatorWebSite/Models/Item.cs deleted file mode 100644 index b1b70b359..000000000 --- a/test/WebSites/ActivatorWebSite/Models/Item.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ActivatorWebSite.Models -{ - public class Item - { - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Services/MyService.cs b/test/WebSites/ActivatorWebSite/Services/MyService.cs deleted file mode 100644 index 35f4fd5b1..000000000 --- a/test/WebSites/ActivatorWebSite/Services/MyService.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ActivatorWebSite -{ - public class MyService - { - public int Random - { - get { return 4; } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Services/ViewService.cs b/test/WebSites/ActivatorWebSite/Services/ViewService.cs deleted file mode 100644 index 11c42c87c..000000000 --- a/test/WebSites/ActivatorWebSite/Services/ViewService.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewFeatures.Internal; - -namespace ActivatorWebSite -{ - /// - /// A service that needs to be contextualized. - /// - public class ViewService : ICanHasViewContext - { - private ViewContext _context; - - public void Contextualize(ViewContext viewContext) - { - _context = viewContext; - } - - public string GetValue() - { - return _context.HttpContext.Request.Query["test"]; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Startup.cs b/test/WebSites/ActivatorWebSite/Startup.cs deleted file mode 100644 index 0f130d297..000000000 --- a/test/WebSites/ActivatorWebSite/Startup.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Builder; -using Microsoft.Extensions.DependencyInjection; - -namespace ActivatorWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - // Add MVC services to the services container - services.AddMvc(); - services.AddSingleton(new MyService()); - services.AddScoped(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - // Used to report exceptions that MVC doesn't handle - app.UseErrorReporter(); - - // Add MVC to the request pipeline - app.UseMvc(routes => - { - routes.MapRoute("ActionAsMethod", "{controller}/{action}", - defaults: new { controller = "Home", action = "Index" }); - }); - } - } -} diff --git a/test/WebSites/ActivatorWebSite/TagHelpers/FooterTagHelper.cs b/test/WebSites/ActivatorWebSite/TagHelpers/FooterTagHelper.cs deleted file mode 100644 index 97fac25fb..000000000 --- a/test/WebSites/ActivatorWebSite/TagHelpers/FooterTagHelper.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewFeatures; -using Microsoft.AspNet.Razor.TagHelpers; - -namespace ActivatorWebSite.TagHelpers -{ - [HtmlTargetElement("body")] - public class FooterTagHelper : TagHelper - { - [HtmlAttributeNotBound] - [ViewContext] - public ViewContext ViewContext { get; set; } - - public override void Process(TagHelperContext context, TagHelperOutput output) - { - output.PostContent - .AppendHtml("
") - .Append((string)ViewContext.ViewData["footer"]) - .AppendHtml("
"); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/TagHelpers/HiddenTagHelper.cs b/test/WebSites/ActivatorWebSite/TagHelpers/HiddenTagHelper.cs deleted file mode 100644 index cb4bfbb21..000000000 --- a/test/WebSites/ActivatorWebSite/TagHelpers/HiddenTagHelper.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text.Encodings.Web; -using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewFeatures; -using Microsoft.AspNet.Mvc.ViewFeatures.Internal; -using Microsoft.AspNet.Razor.TagHelpers; - -namespace ActivatorWebSite.TagHelpers -{ - [HtmlTargetElement("span")] - public class HiddenTagHelper : TagHelper - { - public HiddenTagHelper(IHtmlHelper htmlHelper, HtmlEncoder htmlEncoder) - { - HtmlHelper = htmlHelper; - HtmlEncoder = htmlEncoder; - } - - public IHtmlHelper HtmlHelper { get; } - - public HtmlEncoder HtmlEncoder { get; } - - [HtmlAttributeNotBound] - [ViewContext] - public ViewContext ViewContext { get; set; } - - public string Name { get; set; } - - public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) - { - (HtmlHelper as ICanHasViewContext)?.Contextualize(ViewContext); - - var content = await output.GetChildContentAsync(); - output.Content.SetContent(HtmlHelper.Hidden(Name, content.GetContent(HtmlEncoder))); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/TagHelpers/RepeatContentTagHelper.cs b/test/WebSites/ActivatorWebSite/TagHelpers/RepeatContentTagHelper.cs deleted file mode 100644 index 7f6764c53..000000000 --- a/test/WebSites/ActivatorWebSite/TagHelpers/RepeatContentTagHelper.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewFeatures; -using Microsoft.AspNet.Mvc.ViewFeatures.Internal; -using Microsoft.AspNet.Razor.TagHelpers; - -namespace ActivatorWebSite.TagHelpers -{ - [HtmlTargetElement("div")] - public class RepeatContentTagHelper : TagHelper - { - public RepeatContentTagHelper(IHtmlHelper htmlHelper) - { - HtmlHelper = htmlHelper; - } - - public IHtmlHelper HtmlHelper { get; } - - [HtmlAttributeNotBound] - [ViewContext] - public ViewContext ViewContext { get; set; } - - public int RepeatContent { get; set; } - - public ModelExpression Expression { get; set; } - - public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) - { - (HtmlHelper as ICanHasViewContext)?.Contextualize(ViewContext); - - var content = await output.GetChildContentAsync(); - var repeatContent = HtmlHelper.Encode(Expression.Model.ToString()); - - if (string.IsNullOrEmpty(repeatContent)) - { - repeatContent = content.GetContent(); - } - - for (int i = 0; i < RepeatContent; i++) - { - output.Content.Append(repeatContent); - } - } - - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs b/test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs deleted file mode 100644 index 06b8f9996..000000000 --- a/test/WebSites/ActivatorWebSite/TagHelpers/TitleTagHelper.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Html; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewFeatures; -using Microsoft.AspNet.Mvc.ViewFeatures.Internal; -using Microsoft.AspNet.Razor.TagHelpers; - -namespace ActivatorWebSite.TagHelpers -{ - [HtmlTargetElement("body")] - public class TitleTagHelper : TagHelper - { - public TitleTagHelper(IHtmlHelper htmlHelper) - { - HtmlHelper = htmlHelper; - } - - public IHtmlHelper HtmlHelper { get; } - - [HtmlAttributeNotBound] - [ViewContext] - public ViewContext ViewContext { get; set; } - - public override void Process(TagHelperContext context, TagHelperOutput output) - { - (HtmlHelper as ICanHasViewContext)?.Contextualize(ViewContext); - - var builder = new TagBuilder("h2"); - var title = (string)ViewContext.ViewBag.Title; - builder.InnerHtml.SetContent(title); - output.PreContent.SetContent(builder); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Views/View/ConsumeCannotBeActivatedComponent.cshtml b/test/WebSites/ActivatorWebSite/Views/View/ConsumeCannotBeActivatedComponent.cshtml deleted file mode 100644 index ecfed37d7..000000000 --- a/test/WebSites/ActivatorWebSite/Views/View/ConsumeCannotBeActivatedComponent.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Component.Invoke("CannotBeActivated") \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Views/View/ConsumeDefaultProperties.cshtml b/test/WebSites/ActivatorWebSite/Views/View/ConsumeDefaultProperties.cshtml deleted file mode 100644 index c441e7975..000000000 --- a/test/WebSites/ActivatorWebSite/Views/View/ConsumeDefaultProperties.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Html.Label("Hello") @Component.Invoke("Test", "world") @Url.Action("ConsumeServicesFromBaseType") \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Views/View/ConsumeInjectedService.cshtml b/test/WebSites/ActivatorWebSite/Views/View/ConsumeInjectedService.cshtml deleted file mode 100644 index 3247c972c..000000000 --- a/test/WebSites/ActivatorWebSite/Views/View/ConsumeInjectedService.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@using ActivatorWebSite -@inject MyService MyServiceInstance -@inject ViewService ViewServiceInstance - -@MyServiceInstance.Random @ViewServiceInstance.GetValue() \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Views/View/ConsumeServicesFromBaseType.cshtml b/test/WebSites/ActivatorWebSite/Views/View/ConsumeServicesFromBaseType.cshtml deleted file mode 100644 index bb44de7e7..000000000 --- a/test/WebSites/ActivatorWebSite/Views/View/ConsumeServicesFromBaseType.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Href("~/content/scripts/test.js") diff --git a/test/WebSites/ActivatorWebSite/Views/View/ConsumeViewComponent.cshtml b/test/WebSites/ActivatorWebSite/Views/View/ConsumeViewComponent.cshtml deleted file mode 100644 index 139735af1..000000000 --- a/test/WebSites/ActivatorWebSite/Views/View/ConsumeViewComponent.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Component.Invoke("Number", "Random Number") \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/Views/View/UseTagHelper.cshtml b/test/WebSites/ActivatorWebSite/Views/View/UseTagHelper.cshtml deleted file mode 100644 index a60e2f126..000000000 --- a/test/WebSites/ActivatorWebSite/Views/View/UseTagHelper.cshtml +++ /dev/null @@ -1,14 +0,0 @@ -@using ActivatorWebSite.Models -@model Item - -@addTagHelper *, ActivatorWebSite - -@{ - ViewBag.Title = "Activation Test"; - ViewData["footer"] = "Footer from activated ViewData"; -} - - -
-test content - \ No newline at end of file diff --git a/test/WebSites/ActivatorWebSite/project.json b/test/WebSites/ActivatorWebSite/project.json deleted file mode 100644 index 14c1cb940..000000000 --- a/test/WebSites/ActivatorWebSite/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/ActivatorWebSite/readme.md b/test/WebSites/ActivatorWebSite/readme.md deleted file mode 100644 index d88691549..000000000 --- a/test/WebSites/ActivatorWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -ActivatorWebSite -=== - -This web site demonstrates the use of activate attribute on controller properties, view components and tag helpers. diff --git a/test/WebSites/ActivatorWebSite/wwwroot/HelloWorld.htm b/test/WebSites/ActivatorWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/ActivatorWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/ApplicationModelWebSite/Controllers/LisenceController.cs b/test/WebSites/ApplicationModelWebSite/Controllers/LisenceController.cs index a074533f5..4753d062b 100644 --- a/test/WebSites/ApplicationModelWebSite/Controllers/LisenceController.cs +++ b/test/WebSites/ApplicationModelWebSite/Controllers/LisenceController.cs @@ -5,12 +5,12 @@ using Microsoft.AspNet.Mvc; namespace ApplicationModelWebSite.Controllers { - public class LisenceController : Controller + public class LicenseController : Controller { - [HttpGet("Lisence/GetLisence")] - public string GetLisence() + [HttpGet("License/GetLicense")] + public string GetLicense() { - return ControllerContext.ActionDescriptor.Properties["lisence"].ToString(); + return ControllerContext.ActionDescriptor.Properties["license"].ToString(); } } } \ No newline at end of file diff --git a/test/WebSites/ApplicationModelWebSite/Conventions/ControllerLicenseConvention.cs b/test/WebSites/ApplicationModelWebSite/Conventions/ControllerLicenseConvention.cs index c8dca0734..036436bfe 100644 --- a/test/WebSites/ApplicationModelWebSite/Conventions/ControllerLicenseConvention.cs +++ b/test/WebSites/ApplicationModelWebSite/Conventions/ControllerLicenseConvention.cs @@ -9,7 +9,7 @@ namespace ApplicationModelWebSite { public void Apply(ControllerModel controller) { - controller.Properties["lisence"] = "Copyright (c) .NET Foundation. All rights reserved." + + controller.Properties["license"] = "Copyright (c) .NET Foundation. All rights reserved." + " Licensed under the Apache License, Version 2.0. See License.txt " + "in the project root for license information."; } diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/AbstractController.cs b/test/WebSites/ControllerDiscoveryConventionsWebSite/AbstractController.cs deleted file mode 100644 index 71685223e..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/AbstractController.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ControllerDiscoveryConventionsWebSite -{ - public abstract class AbstractController - { - public string GetValue() - { - return nameof(AbstractController); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/ChildOfAbstract.cs b/test/WebSites/ControllerDiscoveryConventionsWebSite/ChildOfAbstract.cs deleted file mode 100644 index 72865c740..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/ChildOfAbstract.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ControllerDiscoveryConventionsWebSite -{ - public class ChildOfAbstract : AbstractController - { - - } -} \ No newline at end of file diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/ControllerDiscoveryConventionsWebSite.xproj b/test/WebSites/ControllerDiscoveryConventionsWebSite/ControllerDiscoveryConventionsWebSite.xproj deleted file mode 100644 index 855a3f5d0..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/ControllerDiscoveryConventionsWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - a19022ef-9ba3-4349-94e4-f48e13e1c8ae - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 51163 - - - \ No newline at end of file diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/NonControllerController.cs b/test/WebSites/ControllerDiscoveryConventionsWebSite/NonControllerController.cs deleted file mode 100644 index f37158c69..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/NonControllerController.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ControllerDiscoveryConventionsWebSite -{ - [NonController] - public class NonControllerController : Controller - { - public string GetValue() - { - return nameof(NonControllerController); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/PersonApi.cs b/test/WebSites/ControllerDiscoveryConventionsWebSite/PersonApi.cs deleted file mode 100644 index ee5b9fbd2..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/PersonApi.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Web.Http; - -namespace ControllerDiscoveryConventionsWebSite -{ - public class PersonApi : ApiController - { - public string GetValue() - { - return nameof(PersonApi); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/PocoController.cs b/test/WebSites/ControllerDiscoveryConventionsWebSite/PocoController.cs deleted file mode 100644 index 7da84dfc4..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/PocoController.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ControllerDiscoveryConventionsWebSite -{ - public class PocoController - { - public string GetValue() - { - return nameof(PocoController); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/SqlTransactionManager.cs b/test/WebSites/ControllerDiscoveryConventionsWebSite/SqlTransactionManager.cs deleted file mode 100644 index 474db50f6..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/SqlTransactionManager.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace UserClassLibrary -{ - public class SqlTransactionManager : TransactionController - { - public string GetValue() - { - return nameof(SqlTransactionManager); - } - } -} diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/Startup.cs b/test/WebSites/ControllerDiscoveryConventionsWebSite/Startup.cs deleted file mode 100644 index 3feac7d87..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/Startup.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Builder; -using Microsoft.Extensions.DependencyInjection; - -namespace ControllerDiscoveryConventionsWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseMvc(routes => - { - routes.MapRoute("default", "{controller}/{action}/{id?}"); - }); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/project.json b/test/WebSites/ControllerDiscoveryConventionsWebSite/project.json deleted file mode 100644 index 5114a6b0f..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "UserClassLibrary": "1.0.0", - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": {}, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/readme.md b/test/WebSites/ControllerDiscoveryConventionsWebSite/readme.md deleted file mode 100644 index 0886ac540..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/readme.md +++ /dev/null @@ -1 +0,0 @@ -Functional test site for verifying controllers registration rules. diff --git a/test/WebSites/ControllerDiscoveryConventionsWebSite/wwwroot/HelloWorld.htm b/test/WebSites/ControllerDiscoveryConventionsWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/ControllerDiscoveryConventionsWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/CustomRouteWebSite/project.json b/test/WebSites/CustomRouteWebSite/project.json deleted file mode 100644 index 14c1cb940..000000000 --- a/test/WebSites/CustomRouteWebSite/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/CustomRouteWebSite/wwwroot/HelloWorld.htm b/test/WebSites/CustomRouteWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/CustomRouteWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/FormatFilterWebSite/Models/Product.cs b/test/WebSites/FormatFilterWebSite/Models/Product.cs deleted file mode 100644 index 134247341..000000000 --- a/test/WebSites/FormatFilterWebSite/Models/Product.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace FormatFilterWebSite -{ - public class Product - { - public int SampleInt { get; set; } - - public override string ToString() - { - return "SampleInt:" + SampleInt; - } - } -} \ No newline at end of file diff --git a/test/WebSites/FormatFilterWebSite/project.json b/test/WebSites/FormatFilterWebSite/project.json deleted file mode 100644 index 14c1cb940..000000000 --- a/test/WebSites/FormatFilterWebSite/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/FormatFilterWebSite/readme.md b/test/WebSites/FormatFilterWebSite/readme.md deleted file mode 100644 index f132f65a6..000000000 --- a/test/WebSites/FormatFilterWebSite/readme.md +++ /dev/null @@ -1,5 +0,0 @@ -FormatFilterWebSite -=== - -This web site illustrates in depth the process of using new feature Url Media header mappings. It demonstrates adding -Url formats and content type mappings and using them. It also shows how routes need to change for this feature to work. diff --git a/test/WebSites/FormatFilterWebSite/wwwroot/HelloWorld.htm b/test/WebSites/FormatFilterWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/FormatFilterWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn10Controller.cs b/test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn10Controller.cs deleted file mode 100644 index 0b983f8e8..000000000 --- a/test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn10Controller.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNet.Mvc; -using System; - -namespace InlineConstraintsWebSite.Controllers -{ - public class InlineConstraints_Isbn10Controller : Controller - { - public string Index(string isbnNumber) - { - return "10 Digit ISBN Number " + isbnNumber; - } - } -} \ No newline at end of file diff --git a/test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn13Controller.cs b/test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn13Controller.cs deleted file mode 100644 index ade961990..000000000 --- a/test/WebSites/InlineConstraintsWebSite/Controllers/InlineConstraints_Isbn13Controller.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Microsoft.AspNet.Mvc; -using System; - -namespace InlineConstraintsWebSite.Controllers -{ - [Route("book/[action]")] - public class InlineConstraints_Isbn13Controller : Controller - { - [HttpGet("{isbnNumber:IsbnDigitScheme13}")] - public string Index(string isbnNumber) - { - return "13 Digit ISBN Number " + isbnNumber; - } - } -} \ No newline at end of file diff --git a/test/WebSites/InlineConstraintsWebSite/Startup.cs b/test/WebSites/InlineConstraintsWebSite/Startup.cs deleted file mode 100644 index 3072e4f1b..000000000 --- a/test/WebSites/InlineConstraintsWebSite/Startup.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using InlineConstraintsWebSite.Constraints; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Routing.Constraints; -using Microsoft.Extensions.DependencyInjection; - -namespace InlineConstraints -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services.ConfigureRouting( - routeOptions => routeOptions.ConstraintMap.Add( - "IsbnDigitScheme10", - typeof(IsbnDigitScheme10Constraint))); - - services.ConfigureRouting( - routeOptions => routeOptions.ConstraintMap.Add( - "IsbnDigitScheme13", - typeof(IsbnDigitScheme10Constraint))); - - // Update an existing constraint from ConstraintMap for test purpose. - services.ConfigureRouting( - routeOptions => - { - if (routeOptions.ConstraintMap.ContainsKey("IsbnDigitScheme13")) - { - routeOptions.ConstraintMap["IsbnDigitScheme13"] = - typeof(IsbnDigitScheme13Constraint); - } - }); - - // Add MVC services to the services container - services.AddMvc(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseErrorReporter(); - - app.UseMvc(routes => - { - routes.MapRoute( - name: "isbn10", - template: "book/{action}/{isbnNumber:IsbnDigitScheme10(true)}", - defaults: new { controller = "InlineConstraints_Isbn10" }); - - routes.MapRoute("StoreId", - "store/{action}/{id:guid?}", - defaults: new { controller = "InlineConstraints_Store" }); - - routes.MapRoute("StoreLocation", - "store/{action}/{location:minlength(3):maxlength(10)}", - defaults: new { controller = "InlineConstraints_Store" }, - constraints: new { location = new AlphaRouteConstraint() }); - - // Used by tests for the 'exists' constraint. - routes.MapRoute("areaExists-area", "area-exists/{area:exists}/{controller=Home}/{action=Index}"); - routes.MapRoute("areaExists", "area-exists/{controller=Home}/{action=Index}"); - routes.MapRoute("areaWithoutExists-area", "area-withoutexists/{area}/{controller=Home}/{action=Index}"); - routes.MapRoute("areaWithoutExists", "area-withoutexists/{controller=Home}/{action=Index}"); - }); - } - } -} diff --git a/test/WebSites/InlineConstraintsWebSite/project.json b/test/WebSites/InlineConstraintsWebSite/project.json deleted file mode 100644 index 14c1cb940..000000000 --- a/test/WebSites/InlineConstraintsWebSite/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/InlineConstraintsWebSite/wwwroot/HelloWorld.htm b/test/WebSites/InlineConstraintsWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/InlineConstraintsWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/JsonPatchWebSite/project.json b/test/WebSites/JsonPatchWebSite/project.json deleted file mode 100644 index bd8f007c5..000000000 --- a/test/WebSites/JsonPatchWebSite/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/JsonPatchWebSite/wwwroot/HelloWorld.htm b/test/WebSites/JsonPatchWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/JsonPatchWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/LocalizationWebSite/project.json b/test/WebSites/LocalizationWebSite/project.json deleted file mode 100644 index 02eda53c4..000000000 --- a/test/WebSites/LocalizationWebSite/project.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/LocalizationWebSite/readme.md b/test/WebSites/LocalizationWebSite/readme.md deleted file mode 100644 index 9067d4d5f..000000000 --- a/test/WebSites/LocalizationWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -LocalizationWebSite -=== - -This web site illustrates use cases for Mvc localization. diff --git a/test/WebSites/LocalizationWebSite/wwwroot/HelloWorld.htm b/test/WebSites/LocalizationWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/LocalizationWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/LoggingWebSite/ElmLogSerializerMiddleware.cs b/test/WebSites/LoggingWebSite/ElmLogSerializerMiddleware.cs deleted file mode 100644 index 2f8398b2c..000000000 --- a/test/WebSites/LoggingWebSite/ElmLogSerializerMiddleware.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Diagnostics.Elm; -using Microsoft.AspNet.Http; -using Newtonsoft.Json; - -namespace LoggingWebSite -{ - public class ElmLogSerializerMiddleware - { - private readonly RequestDelegate _next; - - public ElmLogSerializerMiddleware(RequestDelegate next) - { - _next = next; - } - - public Task Invoke(HttpContext context, ElmStore elmStore) - { - var currentRequest = context.Request; - - var logActivities = GetLogDetails(elmStore); - - context.Response.StatusCode = StatusCodes.Status200OK; - context.Response.ContentType = "application/json"; - - var serializer = JsonSerializer.Create(); - using (var writer = new JsonTextWriter(new StreamWriter(stream: context.Response.Body, - encoding: Encoding.UTF8, - bufferSize: 1024, - leaveOpen: true))) - { - serializer.Serialize(writer, logActivities); - } - - return Task.FromResult(true); - } - - private IEnumerable GetLogDetails(ElmStore elmStore) - { - var activities = new List(); - foreach (var activity in elmStore.GetActivities().Reverse()) - { - var rootScopeNodeDto = new ScopeNodeDto(); - CopyScopeNodeTree(activity.Root, rootScopeNodeDto); - - activities.Add(new ActivityContextDto() - { - RequestInfo = GetRequestInfoDto(activity.HttpInfo), - Id = activity.Id, - RepresentsScope = activity.RepresentsScope, - Root = rootScopeNodeDto - }); - } - - return activities; - } - - private RequestInfoDto GetRequestInfoDto(HttpInfo httpInfo) - { - if (httpInfo == null) return null; - - return new RequestInfoDto() - { - ContentType = httpInfo.ContentType, - Cookies = httpInfo.Cookies.ToArray(), - Headers = httpInfo.Headers.ToArray(), - Query = httpInfo.Query.Value, - Host = httpInfo.Host.Value, - Method = httpInfo.Method, - Path = httpInfo.Path.Value, - Protocol = httpInfo.Protocol, - RequestID = httpInfo.RequestID, - Scheme = httpInfo.Scheme, - StatusCode = httpInfo.StatusCode - }; - } - - private LogInfoDto GetLogInfoDto(LogInfo logInfo) - { - return new LogInfoDto() - { - EventID = logInfo.EventID, - Exception = logInfo.Exception, - LoggerName = logInfo.Name, - LogLevel = logInfo.Severity, - State = logInfo.State, - StateType = logInfo.State?.GetType() - }; - } - - private void CopyScopeNodeTree(ScopeNode root, ScopeNodeDto rootDto) - { - rootDto.LoggerName = root.Name; - rootDto.State = root.State?.ToString(); - rootDto.StateType = root.State?.GetType(); - - foreach (var logInfo in root.Messages) - { - rootDto.Messages.Add(GetLogInfoDto(logInfo)); - } - - foreach (var scopeNode in root.Children) - { - ScopeNodeDto childDto = new ScopeNodeDto(); - - CopyScopeNodeTree(scopeNode, childDto); - - rootDto.Children.Add(childDto); - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/LoggingWebSite.xproj b/test/WebSites/LoggingWebSite/LoggingWebSite.xproj deleted file mode 100644 index 5f83290bc..000000000 --- a/test/WebSites/LoggingWebSite/LoggingWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 0ad78ab5-d67c-49bc-81b1-0c51bfa82b5e - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 40912 - - - \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/Models/ActivityContextDto.cs b/test/WebSites/LoggingWebSite/Models/ActivityContextDto.cs deleted file mode 100644 index 9f8483bf0..000000000 --- a/test/WebSites/LoggingWebSite/Models/ActivityContextDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace LoggingWebSite -{ - public class ActivityContextDto - { - public Guid Id { get; set; } - - public RequestInfoDto RequestInfo { get; set; } - - public ScopeNodeDto Root { get; set; } - - public bool RepresentsScope { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/Models/LogInfoDto.cs b/test/WebSites/LoggingWebSite/Models/LogInfoDto.cs deleted file mode 100644 index 7482dbac0..000000000 --- a/test/WebSites/LoggingWebSite/Models/LogInfoDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using Microsoft.Extensions.Logging; - -namespace LoggingWebSite -{ - public class LogInfoDto - { - public string LoggerName { get; set; } - - /// - /// Type of object representing the State. This is useful for tests - /// to filter the results - /// - public Type StateType { get; set; } - - public LogLevel LogLevel { get; set; } - - public int EventID { get; set; } - - public object State { get; set; } - - public Exception Exception { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/Models/RequestInfoDto.cs b/test/WebSites/LoggingWebSite/Models/RequestInfoDto.cs deleted file mode 100644 index 7bfe22c44..000000000 --- a/test/WebSites/LoggingWebSite/Models/RequestInfoDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Extensions.Primitives; - -namespace LoggingWebSite -{ - public class RequestInfoDto - { - public string RequestID { get; set; } - - public string Host { get; set; } - - public string Path { get; set; } - - public string ContentType { get; set; } - - public string Scheme { get; set; } - - public int StatusCode { get; set; } - - public string Method { get; set; } - - public string Protocol { get; set; } - - public IEnumerable> Headers { get; set; } - - public string Query { get; set; } - - public IEnumerable> Cookies { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/Models/ScopeNodeDto.cs b/test/WebSites/LoggingWebSite/Models/ScopeNodeDto.cs deleted file mode 100644 index 5acf5153b..000000000 --- a/test/WebSites/LoggingWebSite/Models/ScopeNodeDto.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace LoggingWebSite -{ - public class ScopeNodeDto - { - public List Children { get; private set; } = new List(); - - public List Messages { get; private set; } = new List(); - - public object State { get; set; } - - public Type StateType { get; set; } - - public string LoggerName { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/Properties/debugSettings.json b/test/WebSites/LoggingWebSite/Properties/debugSettings.json deleted file mode 100644 index a44fad34a..000000000 --- a/test/WebSites/LoggingWebSite/Properties/debugSettings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Profiles": [] -} \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/Startup.cs b/test/WebSites/LoggingWebSite/Startup.cs deleted file mode 100644 index 1f8cc75ab..000000000 --- a/test/WebSites/LoggingWebSite/Startup.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Builder; -using Microsoft.Extensions.DependencyInjection; - -namespace LoggingWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services.AddElm(); - - services.ConfigureElm(options => - { - // We want to log for all log levels and loggers - options.Filter = (loggerName, logLevel) => true; - }); - - services.AddMvc(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.Map("/logs", (appBuilder) => - { - appBuilder.UseMiddleware(); - }); - - app.UseElmCapture(); - - app.UseMvc(routes => - { - routes.MapRoute( - name: "default", - template: "{controller}/{action}/{id?}", - defaults: new { controller = "Home", action = "Index" }); - - routes.MapRoute( - name: "api", - template: "{controller}/{id?}"); - }); - } - } -} diff --git a/test/WebSites/LoggingWebSite/Views/Home/Index.cshtml b/test/WebSites/LoggingWebSite/Views/Home/Index.cshtml deleted file mode 100644 index 98b6900f8..000000000 --- a/test/WebSites/LoggingWebSite/Views/Home/Index.cshtml +++ /dev/null @@ -1 +0,0 @@ -Home.Index \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/Views/Shared/_Layout.cshtml b/test/WebSites/LoggingWebSite/Views/Shared/_Layout.cshtml deleted file mode 100644 index 4311c0e37..000000000 --- a/test/WebSites/LoggingWebSite/Views/Shared/_Layout.cshtml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - @ViewBag.Title - My ASP.NET Application - - - -
-
-
- @Html.ActionLink("LoggingWebApplication", "Index", "Home", new { area = "" }) -
-
-
    -
  • @Html.ActionLink("Home", "Index", "Home")
  • -
-
-
-
-
- @RenderBody() -
-
-

© 2014 - My ASP.NET Application

-
-
- - \ No newline at end of file diff --git a/test/WebSites/LoggingWebSite/project.json b/test/WebSites/LoggingWebSite/project.json deleted file mode 100644 index c767943db..000000000 --- a/test/WebSites/LoggingWebSite/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "webroot": "wwwroot", - "exclude": [ - "wwwroot" - ], - "publishExclude": [ - "**.kproj", - "**.user", - "**.vspscc" - ], - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Diagnostics.Elm": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - } -} diff --git a/test/WebSites/LoggingWebSite/readme.md b/test/WebSites/LoggingWebSite/readme.md deleted file mode 100644 index ea7910877..000000000 --- a/test/WebSites/LoggingWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -LoggingWebSite -=== - -This web site illustrates how to register and configure `Elm` logger. diff --git a/test/WebSites/LoggingWebSite/wwwroot/HelloWorld.htm b/test/WebSites/LoggingWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/LoggingWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/LowercaseUrlsWebSite/Controllers/BlogController.cs b/test/WebSites/LowercaseUrlsWebSite/Controllers/BlogController.cs deleted file mode 100644 index dc2c205ac..000000000 --- a/test/WebSites/LowercaseUrlsWebSite/Controllers/BlogController.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace LowercaseUrlsWebSite -{ - public class LowercaseUrls_BlogController : Controller - { - public string ShowPosts() - { - return Url.Action(); - } - - public string Edit(string postName) - { - return Url.Action(); - } - - // Adding extra values than needed to generate the link creates query parameters. The query parameters are not - // lowercased when the URL is - public string GenerateLink() - { - return Url.Action("GetEmployee", "LowercaseUrls_Employee", new { Name = "MaryKae" , LastName = "McDonald"}); - } - } -} \ No newline at end of file diff --git a/test/WebSites/LowercaseUrlsWebSite/Controllers/EmployeeController.cs b/test/WebSites/LowercaseUrlsWebSite/Controllers/EmployeeController.cs deleted file mode 100644 index b5285904a..000000000 --- a/test/WebSites/LowercaseUrlsWebSite/Controllers/EmployeeController.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace LowercaseUrlsWebSite -{ - [Route("api/Employee/[action]/{name?}")] - public class LowercaseUrls_EmployeeController : Controller - { - public string List() - { - return Url.Action(); - } - - public string GetEmployee(string name) - { - return Url.Action(); - } - } -} \ No newline at end of file diff --git a/test/WebSites/LowercaseUrlsWebSite/LowercaseUrlsWebSite.xproj b/test/WebSites/LowercaseUrlsWebSite/LowercaseUrlsWebSite.xproj deleted file mode 100644 index 0c8444f97..000000000 --- a/test/WebSites/LowercaseUrlsWebSite/LowercaseUrlsWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - bcdb13a6-7d6e-485e-8424-a156432b71ac - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 10331 - - - \ No newline at end of file diff --git a/test/WebSites/LowercaseUrlsWebSite/Startup.cs b/test/WebSites/LowercaseUrlsWebSite/Startup.cs deleted file mode 100644 index 4abd063d4..000000000 --- a/test/WebSites/LowercaseUrlsWebSite/Startup.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Routing; -using Microsoft.Extensions.DependencyInjection; - -namespace LowercaseUrlsWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - // Add MVC services to the services container - services.AddMvc(); - - services.Configure(routeOptions => routeOptions.LowercaseUrls = true); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseMvc(routes => - { - routes.MapRoute("Default", "{controller}/{action}/{id?}", - defaults: new { controller = "Home", action = "Index" }); - }); - } - } -} diff --git a/test/WebSites/LowercaseUrlsWebSite/project.json b/test/WebSites/LowercaseUrlsWebSite/project.json deleted file mode 100644 index 14c1cb940..000000000 --- a/test/WebSites/LowercaseUrlsWebSite/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/LowercaseUrlsWebSite/readme.md b/test/WebSites/LowercaseUrlsWebSite/readme.md deleted file mode 100644 index cd432755d..000000000 --- a/test/WebSites/LowercaseUrlsWebSite/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -LowercaseUrlsWebSite -=== -This website illustrates how to set option for lower case URL generation \ No newline at end of file diff --git a/test/WebSites/LowercaseUrlsWebSite/wwwroot/HelloWorld.htm b/test/WebSites/LowercaseUrlsWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 8970971f1..000000000 --- a/test/WebSites/LowercaseUrlsWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/AdditionalValuesMetadataProvider.cs b/test/WebSites/ModelBindingWebSite/AdditionalValuesMetadataProvider.cs deleted file mode 100644 index 875bb4763..000000000 --- a/test/WebSites/ModelBindingWebSite/AdditionalValuesMetadataProvider.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Microsoft.AspNet.Mvc.ModelBinding.Metadata; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite -{ - public class AdditionalValuesMetadataProvider : IDisplayMetadataProvider - { - public static readonly string GroupNameKey = "__GroupName"; - private static Guid _guid = new Guid("7d6d0de2-8d59-49ac-99cc-881423b75a76"); - - public void GetDisplayMetadata(DisplayMetadataProviderContext context) - { - if (context.Key.ModelType == typeof(LargeModelWithValidation)) - { - context.DisplayMetadata.AdditionalValues.Add("key1", _guid); - context.DisplayMetadata.AdditionalValues.Add("key2", "value2"); - } - - var displayAttribute = context.Attributes.OfType().FirstOrDefault(); - var groupName = displayAttribute?.GroupName; - if (!string.IsNullOrEmpty(groupName)) - { - context.DisplayMetadata.AdditionalValues[GroupNameKey] = groupName; - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/CaculatorContext.cs b/test/WebSites/ModelBindingWebSite/CaculatorContext.cs deleted file mode 100644 index 4dbff4854..000000000 --- a/test/WebSites/ModelBindingWebSite/CaculatorContext.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite -{ - public class CalculatorContext - { - public int Left { get; set; } - - public int Right { get; set; } - - public char Operator { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/BindAttributeController.cs b/test/WebSites/ModelBindingWebSite/Controllers/BindAttributeController.cs deleted file mode 100644 index cbdcb44a1..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/BindAttributeController.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ModelBinding; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class BindAttributeController : Controller - { - public User EchoUser([Bind(typeof(ExcludeUserPropertiesAtParameter))] User user) - { - return user; - } - - public User EchoUserUsingServices([Bind(typeof(ExcludeUserPropertiesUsingService))] User user) - { - return user; - } - - public Dictionary - UpdateUserId_BlackListingAtEitherLevelDoesNotBind( - [Bind(typeof(ExcludeLastName))] User2 param1, - [Bind("Id")] User2 param2) - { - return new Dictionary() - { - // LastName is excluded at parameter level. - { "param1.LastName", param1.LastName }, - - // Id is excluded because it is not explicitly included by the bind attribute at type level. - { "param2.Id", param2.Id.ToString() }, - }; - } - - public Dictionary UpdateFirstName_IncludingAtBothLevelBinds( - [Bind("FirstName")] User2 param1) - { - return new Dictionary() - { - // The since FirstName is included at both level it is bound. - { "param1.FirstName", param1.FirstName }, - }; - } - - public Dictionary UpdateIsAdmin_IncludingAtOnlyOneLevelDoesNotBind( - [Bind("IsAdmin" )] User2 param1) - { - return new Dictionary() - { - // IsAdmin is not included because it is not explicitly included at type level. - { "param1.IsAdmin", param1.IsAdmin.ToString() }, - - // FirstName is not included because it is not explicitly included at parameter level. - { "param1.FirstName", param1.FirstName }, - }; - } - - public string BindParameterUsingParameterPrefix([Bind(Prefix = "randomPrefix")] ParameterPrefix param) - { - return param.Value; - } - - public string TypePrefixIsUsed([Bind] TypePrefix param) - { - return param.Value; - } - - private class ExcludeUserPropertiesAtParameter : DefaultPropertyBindingPredicateProvider - { - public override string Prefix - { - get - { - return "user"; - } - } - - public override IEnumerable>> PropertyIncludeExpressions - { - get - { - yield return m => m.RegisterationMonth; - yield return m => m.UserName; - } - } - } - - private class ExcludeUserPropertiesUsingService : ExcludeUserPropertiesAtParameter - { - private ITestService _testService; - - public ExcludeUserPropertiesUsingService(ITestService testService) - { - _testService = testService; - } - - public override IEnumerable>> PropertyIncludeExpressions - { - get - { - if (_testService.Test()) - { - return base.PropertyIncludeExpressions; - } - - return null; - } - } - } - } - - [Bind(Prefix = "TypePrefix")] - public class TypePrefix - { - public string Value { get; set; } - } - - public class ParameterPrefix - { - public string Value { get; set; } - } - - [Bind(nameof(FirstName), nameof(LastName))] - public class User2 - { - public int Id { get; set; } - - public string FirstName { get; set; } - - public string LastName { get; set; } - - public bool IsAdmin { get; set; } - } - - public class ExcludeLastName : IPropertyBindingPredicateProvider - { - public Func PropertyFilter - { - get - { - return (context, propertyName) => - !string.Equals("LastName", propertyName, StringComparison.OrdinalIgnoreCase); - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/BindingBehaviorController.cs b/test/WebSites/ModelBindingWebSite/Controllers/BindingBehaviorController.cs deleted file mode 100644 index 97baca92c..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/BindingBehaviorController.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite -{ - [Route("BindingBehavior")] - public class BindingBehaviorController : Controller - { - // If the results are valid you get back the model, otherwise you get the ModelState errors. - [HttpPost("EchoModelValues")] - public object EchoModelValues(BindingBehaviorModel model) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - return model; - } - } -} diff --git a/test/WebSites/ModelBindingWebSite/Controllers/CompositeTestController.cs b/test/WebSites/ModelBindingWebSite/Controllers/CompositeTestController.cs deleted file mode 100644 index 48e0f5592..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/CompositeTestController.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Controllers -{ - [Route("/CompositeTest/[action]/{param}")] - public class CompositeTestController : Controller - { - public string RestrictValueProvidersUsingFromQuery([FromQuery] string param) - { - return param; - } - - public string RestrictValueProvidersUsingFromRoute([FromRoute] string param) - { - return param; - } - - public string RestrictValueProvidersUsingFromForm([FromForm] string param) - { - return param; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/DataMemberRequiredController.cs b/test/WebSites/ModelBindingWebSite/Controllers/DataMemberRequiredController.cs deleted file mode 100644 index 4afe82edb..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/DataMemberRequiredController.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite -{ - [Route("DataMemberRequired")] - public class DataMemberRequiredController : Controller - { - // If the results are valid you get back the model, otherwise you get the ModelState errors. - [HttpPost("EchoModelValues")] - public object EchoModelValues(DataMemberRequiredModel model) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - return model; - } - } -} diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FileUploadController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FileUploadController.cs deleted file mode 100644 index 55ab34e23..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FileUploadController.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Http; -using Microsoft.Net.Http.Headers; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class FileUploadController : Controller - { - public FileDetails UploadSingle(IFormFile file) - { - FileDetails fileDetails; - using (var reader = new StreamReader(file.OpenReadStream())) - { - var fileContent = reader.ReadToEnd(); - var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition); - fileDetails = new FileDetails - { - Filename = parsedContentDisposition.FileName, - Content = fileContent - }; - } - - return fileDetails; - } - - public FileDetails[] UploadMultiple(IEnumerable files) - { - var fileDetailsList = new List(); - foreach (var file in files) - { - var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition); - using (var reader = new StreamReader(file.OpenReadStream())) - { - var fileContent = reader.ReadToEnd(); - var fileDetails = new FileDetails - { - Filename = parsedContentDisposition.FileName, - Content = fileContent - }; - fileDetailsList.Add(fileDetails); - } - } - - return fileDetailsList.ToArray(); - } - - public IDictionary> UploadMultipleList(IEnumerable filelist1, - IEnumerable filelist2) - { - var fileDetailsDict = new Dictionary> - { - { "filelist1", new List() }, - { "filelist2", new List() } - }; - var fileDetailsList = new List(); - foreach (var file in filelist1.Concat(filelist2)) - { - var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition); - using (var reader = new StreamReader(file.OpenReadStream())) - { - var fileContent = reader.ReadToEnd(); - var fileDetails = new FileDetails - { - Filename = parsedContentDisposition.FileName, - Content = fileContent - }; - fileDetailsDict[parsedContentDisposition.Name].Add(fileDetails); - } - } - - return fileDetailsDict; - } - - public KeyValuePair UploadModelWithFile(Book book) - { - var file = book.File; - var reader = new StreamReader(file.OpenReadStream()); - var fileContent = reader.ReadToEnd(); - var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition); - var fileDetails = new FileDetails - { - Filename = parsedContentDisposition.FileName, - Content = fileContent - }; - - return new KeyValuePair(book.Name, fileDetails); - } - } -} diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FormCollectionController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FormCollectionController.cs deleted file mode 100644 index e9fcf1854..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FormCollectionController.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.IO; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Controllers -{ - public class FormCollectionController : Controller - { - public IList ReturnValuesAsList(IFormCollection form) - { - var valuesList = new List(); - - valuesList.Add(form["field1"]); - valuesList.Add(form["field2"]); - - return valuesList; - } - - public int ReturnCollectionCount(IFormCollection form) - { - return form.Count; - } - - public ActionResult ReturnFileContent(IFormCollection form) - { - var file = form.Files.GetFile("File"); - using (var reader = new StreamReader(file.OpenReadStream())) - { - var fileContent = reader.ReadToEnd(); - - return Content(fileContent); - } - } - } -} diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FromAttributesController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FromAttributesController.cs deleted file mode 100644 index badf3b39b..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FromAttributesController.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class FromAttributesController : Controller - { - [Route("/FromAttributes/[action]/{HomeAddress.Street}/{HomeAddress.State}/{HomeAddress.Zip}")] - public User_FromBody GetUser_FromBody(User_FromBody user) - { - return user; - } - - [Route("/FromAttributes/[action]/{HomeAddress.Street}/{HomeAddress.State}/{HomeAddress.Zip}")] - public User_FromForm GetUser_FromForm(User_FromForm user) - { - return user; - } - - [Route("/FromAttributes/[action]/{HomeAddress.Street}/{HomeAddress.State}/{HomeAddress.Zip}")] - public User_FromForm GetUser([FromRoute] Address homeAddress, - [FromForm] Address officeAddress, - [FromQuery] Address shippingAddress) - { - return new User_FromForm - { - HomeAddress = homeAddress, - OfficeAddress = officeAddress, - ShippingAddress = shippingAddress - }; - } - - public User_FromForm MultipleFromFormParameters([FromForm] Address homeAddress, - [FromForm] Address officeAddress) - { - return new User_FromForm - { - HomeAddress = homeAddress, - OfficeAddress = officeAddress, - }; - } - - // User_FromForm has a FromForm property. - public User_FromForm MultipleFromFormParameterAndProperty(User_FromForm user, - [FromForm] Address defaultAddress) - { - user.HomeAddress = defaultAddress; - return user; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FromBodyControllerPropertyController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FromBodyControllerPropertyController.cs deleted file mode 100644 index 19bafdddc..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FromBodyControllerPropertyController.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class FromBodyControllerProperty : Controller - { - [FromBody] - public User SiteUser { get; set; } - - public User GetSiteUser(int id) - { - return SiteUser; - } - - // Will throw as Customer reads body. - public Customer GetCustomer(Customer customer) - { - return customer; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FromFormAttribute_CompanyController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FromFormAttribute_CompanyController.cs deleted file mode 100644 index c37926c76..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FromFormAttribute_CompanyController.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - [Route("FromFormAttribute_Company/[action]")] - public class FromFormAttribute_CompanyController : Controller - { - public Company CreateCompany([FromForm(Name = "customPrefix")] Company company) - { - return company; - } - - public FromForm_Department CreateDepartment(FromForm_Department department) - { - return department; - } - - public Company CreateCompanyFromEmployees([FromForm(Name = "customPrefix")] IList employees) - { - return new Company { Employees = employees }; - } - - public object ValidateDepartment(FromForm_Department department) - { - return new Result() - { - Value = department.Employees, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - public class FromForm_Department - { - [FromForm(Name = "TestEmployees")] - [Required] - public IEnumerable Employees { get; set; } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FromHeader_BlogController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FromHeader_BlogController.cs deleted file mode 100644 index ff79a7095..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FromHeader_BlogController.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Controllers -{ - [Route("Blog")] - public class FromHeader_BlogController : Controller - { - [HttpGet("BindToProperty/CustomName")] - public object BindToProperty(BlogWithHeaderOnProperty blogWithHeader) - { - return new Result() - { - HeaderValue = blogWithHeader.Title, - HeaderValues = blogWithHeader.Tags, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - // Echo back the header value - [HttpGet("BindToStringParameter")] - public object BindToStringParameter([FromHeader] string transactionId) - { - return new Result() - { - HeaderValue = transactionId, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - // Echo back the header value - [HttpGet("BindToStringParameterDefaultValue")] - public object BindToStringParameterDefaultValue([FromHeader] string transactionId = "default-value") - { - return new Result() - { - HeaderValue = transactionId, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - // Echo back the header values - [HttpGet("BindToStringArrayParameter")] - public object BindToStringArrayParameter([FromHeader] string[] transactionIds) - { - return new Result() - { - HeaderValues = transactionIds, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - [HttpGet("BindToStringParameter/CustomName")] - public object BindToStringParameterWithCustomName([FromHeader(Name = "tId")] string transactionId) - { - return new Result() - { - HeaderValue = transactionId, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - [HttpGet("BindToModel")] - public object BindToModel(BlogPost blogPost) - { - return new Result() - { - HeaderValue = blogPost.Title, - HeaderValues = blogPost.Tags, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - [HttpGet("BindToModelWithInitializedValue")] - public object BindToModelWithInitializedValue(BlogPostWithInitializedValue blogPost) - { - return new Result() - { - HeaderValue = blogPost.Title, - HeaderValues = blogPost.Tags, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - private class Result - { - public string HeaderValue { get; set; } - - public string[] HeaderValues { get; set; } - - public string[] ModelStateErrors { get; set; } - } - - public class BlogPost - { - [Required] - [FromHeader] - public string Title { get; set; } - - [FromHeader] - public string[] Tags { get; set; } - - public string Author { get; set; } - } - - public class BlogWithHeaderOnProperty - { - [FromHeader(Name = "BlogTitle")] - [Required] - public string Title { get; set; } - - [FromHeader(Name = "BlogTags")] - [Required] - public string[] Tags { get; set; } - - public string Author { get; set; } - } - - public class BlogPostWithInitializedValue - { - [Required] - [FromHeader] - public string Title { get; set; } = "How to Make Soup"; - - [FromHeader] - public string[] Tags { get; set; } = new string[] { "Cooking" }; - - public string Author { get; set; } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FromQueryAttribute_CompanyController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FromQueryAttribute_CompanyController.cs deleted file mode 100644 index 9e29a2025..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FromQueryAttribute_CompanyController.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - [Route("FromQueryAttribute_Company/[action]")] - public class FromQueryAttribute_CompanyController : Controller - { - public Company CreateCompany([FromQuery(Name = "customPrefix")] Company company) - { - return company; - } - - public Company CreateCompanyFromEmployees([FromQuery(Name = "customPrefix")] IList employees) - { - return new Company { Employees = employees }; - } - - public FromQuery_Department CreateDepartment(FromQuery_Department department) - { - return department; - } - - public object ValidateDepartment(FromQuery_Department department) - { - return new Result() - { - Value = department.Employees, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - public class FromQuery_Department - { - [FromQuery(Name = "TestEmployees")] - [Required] - public IEnumerable Employees { get; set; } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FromRouteAttribute_CompanyController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FromRouteAttribute_CompanyController.cs deleted file mode 100644 index ddf475142..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FromRouteAttribute_CompanyController.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - [Route("FromRouteAttribute_Company/[action]/{customPrefix.Name}")] - public class FromRouteAttribute_CompanyController : Controller - { - [HttpGet("{customPrefix.EmployeeTaxId?}")] - public Employee CreateEmployee([FromRoute(Name = "customPrefix")] Employee employee) - { - return employee; - } - - public Company CreateCompanyFromEmployees([FromRoute(Name = "customPrefix")] IList employees) - { - return new Company { Employees = employees }; - } - - public object ValidateDepartment(FromRoute_Department department) - { - return new Result() - { - Value = department.Employees, - ModelStateErrors = ModelState.Where(kvp => kvp.Value.Errors.Count > 0).Select(kvp => kvp.Key).ToArray(), - }; - } - - public class FromRoute_Department - { - [FromRoute(Name = "TestEmployees")] - [Required] - public IEnumerable Employees { get; set; } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/FromServices_CalculatorController.cs b/test/WebSites/ModelBindingWebSite/Controllers/FromServices_CalculatorController.cs deleted file mode 100644 index 9290ff107..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/FromServices_CalculatorController.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Controllers -{ - public class FromServices_CalculatorController : Controller - { - public int Calculate(CalculatorContext context, [FromServices] ICalculator calculator) - { - return calculator.Operation(context.Operator, context.Left, context.Right); - } - - public int Add(int left, int right, [FromServices] ICalculator calculator) - { - return calculator.Operation('+', left, right); - } - - public int CalculateWithPrecision(DefaultCalculatorContext context, [FromServices] ICalculator calculator) - { - return calculator.Operation(context.Operator, context.Left, context.Right); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/HomeController.cs b/test/WebSites/ModelBindingWebSite/Controllers/HomeController.cs deleted file mode 100644 index 1440fb1c0..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/HomeController.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class HomeController : Controller - { - [HttpGet] - public IActionResult Index(byte[] byteValues) - { - if (byteValues == null) - { - return Content(content: null); - } - - return Content(System.Text.Encoding.UTF8.GetString(byteValues)); - } - - [HttpPost("/integers")] - public IActionResult CollectionToJson(int[] model) - { - return Json(model); - } - - [HttpPost("/cities")] - public IActionResult PocoCollectionToJson(List model) - { - return Json(model); - } - - public object ModelWithTooManyValidationErrors(LargeModelWithValidation model) - { - return CreateValidationDictionary(); - } - - public object ModelWithFewValidationErrors(ModelWithValidation model) - { - return CreateValidationDictionary(); - } - - public bool ActionWithCancellationToken(CancellationToken token) - { - return token == HttpContext.RequestAborted; - } - - public bool ActionWithCancellationTokenModel(CancellationTokenModel wrapper) - { - return wrapper.CancellationToken == HttpContext.RequestAborted; - } - - [HttpGet("Home/ActionWithPersonFromUrlWithPrefix/{person.name}/{person.age}")] - public Person ActionWithPersonFromUrlWithPrefix([FromRoute] Person person) - { - return person; - } - - [HttpGet("Home/ActionWithPersonFromUrlWithoutPrefix/{name}/{age}")] - public Person ActionWithPersonFromUrlWithoutPrefix([FromRoute] Person person) - { - return person; - } - - public Customer GetCustomer(int id) - { - var customer = CreateCustomer(id); - - // should update customer.Department from body. - TryUpdateModelAsync(customer); - - return customer; - } - - public IActionResult GetErrorMessage(DateTime birthdate) - { - return Content(ModelState[nameof(birthdate)].Errors[0].ErrorMessage); - } - - private Customer CreateCustomer(int id) - { - return new Customer() - { - Id = id, - Name = "dummy", - Age = 25, - }; - } - - private Dictionary CreateValidationDictionary() - { - var result = new Dictionary(); - foreach (var item in ModelState) - { - var error = item.Value.Errors.SingleOrDefault(); - if (error != null) - { - var value = error.Exception != null ? error.Exception.Message : - error.ErrorMessage; - result.Add(item.Key, value); - } - } - - return result; - } - - public class CancellationTokenModel - { - public CancellationToken CancellationToken { get; set; } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_CompanyController.cs b/test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_CompanyController.cs deleted file mode 100644 index f2ce94a13..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_CompanyController.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - [Route("ModelBinderAttribute_Company/[action]")] - public class ModelBinderAttribute_CompanyController : Controller - { - // Uses Name to set a custom prefix - public Company GetCompany([ModelBinder(Name = "customPrefix")] Company company) - { - return company; - } - - public Company CreateCompany(IList employees) - { - return new Company { Employees = employees }; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_ProductController.cs b/test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_ProductController.cs deleted file mode 100644 index 365feb282..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/ModelBinderAttribute_ProductController.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Threading.Tasks; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ModelBinding; - -namespace ModelBindingWebSite.Controllers -{ - [Route("ModelBinderAttribute_Product/[action]")] - public class ModelBinderAttribute_ProductController : Controller - { - public string GetBinderType_UseModelBinderOnType( - [ModelBinder(Name = "customPrefix")] ProductWithBinderOnType model) - { - return model.BinderType.FullName; - } - - public string GetBinderType_UseModelBinder( - [ModelBinder(BinderType = typeof(ProductModelBinder))] Product model) - { - return model.BinderType.FullName; - } - - public string GetBinderType_UseModelBinderOnProperty(Order order) - { - return order.Product.BinderType.FullName; - } - - public string ModelBinderAttribute_UseModelBinderOnEnum(OrderStatus status) - { - return status.ToString(); - } - - public class Product - { - public int ProductId { get; set; } - - // Will be set by the binder - public Type BinderType { get; set; } - } - - [ModelBinder(BinderType = typeof(ProductModelBinder))] - public class ProductWithBinderOnType : Product - { - } - - public class Order - { - [ModelBinder(BinderType = typeof(ProductModelBinder))] - public Product Product { get; set; } - } - - [ModelBinder(BinderType = typeof(OrderStatusBinder))] - public enum OrderStatus - { - StatusOutOfStock, - StatusShipped, - StatusRecieved, - } - - private class OrderStatusBinder : IModelBinder - { - public Task BindModelAsync(ModelBindingContext bindingContext) - { - if (typeof(OrderStatus).IsAssignableFrom(bindingContext.ModelType)) - { - var request = bindingContext.OperationBindingContext.HttpContext.Request; - - // Doing something slightly different here to make sure we don't get accidentally bound - // by the type converter binder. - OrderStatus model; - if (Enum.TryParse("Status" + request.Query["status"], out model)) - { - return ModelBindingResult.SuccessAsync("status", model); - } - - return ModelBindingResult.FailedAsync("status"); - } - - return ModelBindingResult.NoResultAsync; - } - } - - private class ProductModelBinder : IModelBinder - { - public Task BindModelAsync(ModelBindingContext bindingContext) - { - if (typeof(Product).IsAssignableFrom(bindingContext.ModelType)) - { - var model = (Product)Activator.CreateInstance(bindingContext.ModelType); - - model.BinderType = GetType(); - - var key = - string.IsNullOrEmpty(bindingContext.ModelName) ? - "productId" : - bindingContext.ModelName + "." + "productId"; - - var value = bindingContext.ValueProvider.GetValue(key); - model.ProductId = value.ConvertTo(); - - return ModelBindingResult.SuccessAsync(key, model); - } - - return ModelBindingResult.NoResultAsync; - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/ModelMetadataController.cs b/test/WebSites/ModelBindingWebSite/Controllers/ModelMetadataController.cs deleted file mode 100644 index 7f46aaec2..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/ModelMetadataController.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ModelBinding; -using ModelBindingWebSite.Models; -using ModelBindingWebSite.ViewModels; - -namespace ModelBindingWebSite.Controllers -{ - public class ModelMetadataController - { - [HttpGet(template: "/AdditionalValues")] - public IReadOnlyDictionary GetAdditionalValues([FromServices] IModelMetadataProvider provider) - { - var metadata = provider.GetMetadataForType(typeof(LargeModelWithValidation)); - - return metadata.AdditionalValues; - } - - [HttpGet(template: "/GroupNames")] - public IDictionary GetGroupNames([FromServices] IModelMetadataProvider provider) - { - var groupNames = new Dictionary(); - var metadata = provider.GetMetadataForType(typeof(VehicleViewModel)); - foreach (var property in metadata.Properties) - { - groupNames.Add(property.PropertyName, property.GetGroupName()); - } - - return groupNames; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/Person_CollectionBinderController.cs b/test/WebSites/ModelBindingWebSite/Controllers/Person_CollectionBinderController.cs deleted file mode 100644 index 86b6a9a8a..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/Person_CollectionBinderController.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class Person_CollectionBinderController : Controller - { - public PersonAddress CollectionType(PersonAddress address) - { - return address; - } - - public UserWithAddress NestedCollectionType(UserWithAddress user) - { - return user; - } - - public PeopleModel NestedCollectionOfRecursiveTypes(PeopleModel model) - { - return model; - } - - public bool PostCheckBox(bool isValid) - { - return isValid; - } - - public IEnumerable PostCheckBoxList(IEnumerable userPreferences) - { - return userPreferences; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/PropertiesGetCreatedController.cs b/test/WebSites/ModelBindingWebSite/Controllers/PropertiesGetCreatedController.cs deleted file mode 100644 index dc04bde21..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/PropertiesGetCreatedController.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class PropertiesController : Controller - { - public Company GetCompany(Company c) - { - return c; - } - - public PersonWithNoProperties GetPerson(PersonWithNoProperties p) - { - return p; - } - - public ArrayOfPersonWithNoProperties GetPeople(ArrayOfPersonWithNoProperties p) - { - return p; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/RoundtripController.cs b/test/WebSites/ModelBindingWebSite/Controllers/RoundtripController.cs deleted file mode 100644 index 55bb6e588..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/RoundtripController.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Threading.Tasks; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewEngines; -using Microsoft.AspNet.Mvc.ViewFeatures; -using Microsoft.AspNet.Mvc.ViewFeatures.Internal; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class RoundtripController : Controller - { - private IHtmlHelper _personHelper; - private bool _activated; - - public RoundtripController(IHtmlHelper personHelper) - { - _personHelper = personHelper; - } - - public IHtmlHelper PersonHelper - { - get - { - if (!_activated) - { - _activated = true; - var viewData = new ViewDataDictionary(ViewData); - var context = new ViewContext( - ControllerContext, - new TestView(), - viewData, - TempData, - TextWriter.Null, - new HtmlHelperOptions()); - - ((ICanHasViewContext)_personHelper).Contextualize(context); - } - - return _personHelper; - } - } - - public string GetPerson() - { - return PersonHelper.NameFor(p => p.Name); - } - - public string GetPersonParentAge() - { - return PersonHelper.NameFor(p => p.Parent.Age); - } - - public string GetPersonDependentAge() - { - return PersonHelper.NameFor(p => p.Dependents[0].Age); - } - - public string GetDependentPersonName() - { - return PersonHelper.NameFor(p => p.Dependents[0].Dependents[0].Name); - } - - public string GetPersonParentHeightAttribute() - { - return PersonHelper.NameFor(p => p.Parent.Attributes["height"]); - } - - [HttpPost] - public Person Person(Person boundPerson) - { - return boundPerson; - } - - private sealed class TestView : IView - { - public string Path { get; set; } - - public Task RenderAsync(ViewContext context) - { - throw new NotImplementedException(); - } - } - } -} diff --git a/test/WebSites/ModelBindingWebSite/Controllers/TryUpdateModelController.cs b/test/WebSites/ModelBindingWebSite/Controllers/TryUpdateModelController.cs deleted file mode 100644 index f20561174..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/TryUpdateModelController.cs +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Globalization; -using System.Threading.Tasks; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Http.Internal; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ModelBinding; -using Microsoft.Extensions.Primitives; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class TryUpdateModelController : Controller - { - public async Task GetPerson() - { - // Person has a property of type Person. Only Top level should be updated. - var person = new Person(); - await TryUpdateModelAsync( - person, - prefix: string.Empty, - includeExpressions: m => m.Parent); - - return person; - } - - public async Task GetUserAsync_IncludeAllByDefault(int id) - { - var user = GetUser(id); - - await TryUpdateModelAsync(user, prefix: string.Empty); - return user; - } - - public async Task GetUserAsync_ExcludeSpecificProperties(int id) - { - var user = GetUser(id); - await TryUpdateModelAsync( - user, - prefix: string.Empty, - predicate: - (context, modelName) => - !string.Equals(modelName, nameof(Models.User.Id), StringComparison.Ordinal) && - !string.Equals(modelName, nameof(Models.User.Key), StringComparison.Ordinal)); - - return user; - } - - public async Task CreateAndUpdateUser() - { - // don't update the id. - var user = new User(); - return await TryUpdateModelAsync(user, - prefix: string.Empty, - includeExpressions: model => model.RegisterationMonth); - } - - public async Task GetUserAsync_IncludeSpecificProperties(int id) - { - var user = GetUser(id); - await TryUpdateModelAsync(user, - prefix: string.Empty, - includeExpressions: model => model.RegisterationMonth); - - return user; - } - - public async Task TryUpdateModelFails(int id) - { - var user = GetUser(id); - return await TryUpdateModelAsync(user, - prefix: string.Empty, - valueProvider: new CustomValueProvider()); - } - - public async Task GetUserAsync_IncludeAndExcludeListNull(int id) - { - var user = GetUser(id); - await TryUpdateModelAsync(user); - - return user; - } - - public async Task GetUserAsync_IncludesAllSubProperties(int id) - { - var user = GetUser(id); - - await TryUpdateModelAsync(user, prefix: string.Empty, includeExpressions: model => model.Address); - - return user; - } - - public async Task GetUserAsync_WithChainedProperties(int id) - { - var user = GetUser(id); - - // Since this is a chained expression this would throw - await TryUpdateModelAsync(user, prefix: string.Empty, includeExpressions: model => model.Address.Country); - - return user; - } - - public async Task GetEmployeeAsync_BindToBaseDeclaredType() - { - var backingStore = new QueryCollection( - new Dictionary - { - { "Parent.Name", new[] { "fatherName"} }, - { "Parent.Parent.Name", new[] {"grandFatherName" } }, - { "Department", new[] {"Sales" } } - }); - - Person employee = new Employee(); - await TryUpdateModelAsync( - employee, - employee.GetType(), - prefix: string.Empty, - valueProvider: new QueryStringValueProvider( - BindingSource.Query, - backingStore, - CultureInfo.CurrentCulture), - predicate: (content, propertyName) => true); - - return (Employee)employee; - } - - public async Task GetUserAsync_ModelType_IncludeAll(int id) - { - var backingStore = new QueryCollection( - new Dictionary - { - { "Key", new[] { "123"} }, - { "RegisterationMonth", new[] {"March" } }, - { "UserName", new[] {"SomeName" } } - }); - - var user = GetUser(id); - - await TryUpdateModelAsync(user, - typeof(User), - prefix: string.Empty, - valueProvider: new QueryStringValueProvider( - BindingSource.Query, - backingStore, - CultureInfo.CurrentCulture), - predicate: (content, propertyName) => true); - - return user; - } - - public async Task GetUserAsync_ModelType_IncludeAllByDefault(int id) - { - var user = GetUser(id); - - await TryUpdateModelAsync(user, user.GetType(), prefix: string.Empty); - return user; - } - - public async Task TryUpdateModel_ClearsModelStateEntries() - { - var result = new ObjectResult(null); - - // Invalid model. - var model = new MyModel - { - Id = 1, - Price = -1 - }; - - // Validate model first and subsequent TryUpdateModel should remove - //modelstate entries for model and re-validate. - TryValidateModel(model); - - // Update Name to a valid value and call TryUpdateModel - model.Price = 1; - await TryUpdateModelAsync(model); - - if (ModelState.IsValid) - { - result.StatusCode = StatusCodes.Status204NoContent; - } - else - { - result.StatusCode = StatusCodes.Status500InternalServerError; - } - - return result; - } - - private User GetUser(int id) - { - return new User - { - UserName = "User_" + id, - Id = id, - Key = id + 20, - }; - } - - private class MyModel - { - public int Id { get; set; } - - [Range(0,10)] - public double Price { get; set; } - } - - public class CustomValueProvider : IValueProvider - { - public bool ContainsPrefix(string prefix) - { - return false; - } - - public ValueProviderResult GetValue(string key) - { - return ValueProviderResult.None; - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/ValidationController.cs b/test/WebSites/ModelBindingWebSite/Controllers/ValidationController.cs deleted file mode 100644 index 54e207233..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/ValidationController.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Controllers -{ - [Route("Validation/[Action]")] - public class ValidationController : Controller - { - public object AvoidRecursive(SelfishPerson selfishPerson) - { - return ModelState.IsValid; - } - - public object DoNotValidateParameter([FromServices] ITestService service) - { - return ModelState.IsValid; - } - } - - public class SelfishPerson - { - public string Name { get; set; } - - public SelfishPerson MySelf { get { return this; } } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/VehicleController.cs b/test/WebSites/ModelBindingWebSite/Controllers/VehicleController.cs deleted file mode 100644 index 471877cfb..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/VehicleController.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.ViewModels; -using ModelBindingWebSite.Services; - -namespace ModelBindingWebSite -{ - public class VehicleController : Controller - { - private static VehicleViewModel _vehicle = new VehicleViewModel - { - InspectedDates = new[] - { - // 01/04/2001 00:00:00 -08:00 - new DateTimeOffset( - year: 2001, - month: 4, - day: 1, - hour: 0, - minute: 0, - second: 0, - offset: TimeSpan.FromHours(-8)), - }, - Make = "Fast Cars", - Model = "the Fastener", - Vin = "87654321", - Year = 2013, - }; - - [HttpPut("/api/vehicles/{id}")] - [Produces("application/json")] - public object UpdateVehicleApi( - int id, - [FromBody] VehicleViewModel model, - [FromServices] IVehicleService service, - [FromHeader(Name = "X-TrackingId")] string trackingId) - { - if (!ModelState.IsValid) - { - return SerializeModelState(); - } - - service.Update(id, model, trackingId); - - return model; - } - - [HttpPost("/dealers/{dealer.id:int}/update-vehicle")] - public IActionResult UpdateDealerVehicle(VehicleWithDealerViewModel model) - { - if (!ModelState.IsValid) - { - return PartialView("UpdateVehicle", model); - } - - return PartialView("UpdateSuccessful", model); - } - - [HttpGet("/vehicles/{id:int}")] - public IActionResult Details(int id) - { - if (id != 42) - { - return HttpNotFound(); - } - - return View(_vehicle); - } - - [HttpGet("/vehicles/{id:int}/edit")] - public IActionResult Edit(int id) - { - if (id != 42) - { - return HttpNotFound(); - } - - // Provide room for one additional inspection if not already full. - var vehicle = _vehicle; - var length = vehicle.InspectedDates.Length; - if (length < 10) - { - var array = new DateTimeOffset[length + 1]; - vehicle.InspectedDates.CopyTo(array, 0); - - // Don't update the stored VehicleViewModel instance. - vehicle = new VehicleViewModel - { - InspectedDates = array, - LastUpdatedTrackingId = vehicle.LastUpdatedTrackingId, - Make = vehicle.Make, - Model = vehicle.Model, - Vin = vehicle.Vin, - Year = vehicle.Year, - }; - } - - return View(vehicle); - } - - [HttpPost("/vehicles/{id:int}/edit")] - public IActionResult Edit(int id, VehicleViewModel vehicle) - { - if (id != 42) - { - return HttpNotFound(); - } - - if (!ModelState.IsValid) - { - return View(vehicle); - } - - if (vehicle.InspectedDates != null) - { - // Ignore empty inspection values. - var nonEmptyDates = vehicle.InspectedDates.Where(date => date != default(DateTimeOffset)).ToArray(); - vehicle.InspectedDates = nonEmptyDates; - } - - _vehicle = vehicle; - - return RedirectToAction(nameof(Details), new { id = id }); - } - - public IDictionary> SerializeModelState() - { - Response.StatusCode = StatusCodes.Status400BadRequest; - - return ModelState.Where(item => item.Value.Errors.Count > 0) - .ToDictionary(item => item.Key, item => item.Value.Errors.Select(e => e.ErrorMessage)); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/WithBinderMetadataController.cs b/test/WebSites/ModelBindingWebSite/Controllers/WithBinderMetadataController.cs deleted file mode 100644 index 00ed37e1e..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/WithBinderMetadataController.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class WithBinderMetadataController : Controller - { - public EmployeeWithBinderMetadata BindWithTypeMetadata(EmployeeWithBinderMetadata emp) - { - return emp; - } - - public DerivedEmployee TypeMetadataAtDerivedTypeWinsOverTheBaseType(DerivedEmployee emp) - { - return emp; - } - - public void ParameterMetadataOverridesTypeMetadata([FromBody] Employee emp) - { - } - - public Employee ParametersWithNoValueProviderMetadataUseTheAvailableValueProviders([FromQuery] Employee emp) - { - return emp; - } - - public Document EchoDocument(Document poco) - { - return poco; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Controllers/WithoutBinderMetadataController.cs b/test/WebSites/ModelBindingWebSite/Controllers/WithoutBinderMetadataController.cs deleted file mode 100644 index e7ef9a819..000000000 --- a/test/WebSites/ModelBindingWebSite/Controllers/WithoutBinderMetadataController.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Mvc; -using ModelBindingWebSite.Models; - -namespace ModelBindingWebSite.Controllers -{ - public class WithoutBinderMetadataController : Controller - { - public Person Person { get; set; } - - public Person GetPersonProperty() - { - return Person; - } - - public Person GetPersonParameter(Person p) - { - return p; - } - - public void SimpleTypes(int id, string name, bool isValid, DateTime lastUpdateTime) - { - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/DefaultCalculator.cs b/test/WebSites/ModelBindingWebSite/DefaultCalculator.cs deleted file mode 100644 index 835aad778..000000000 --- a/test/WebSites/ModelBindingWebSite/DefaultCalculator.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Extensions.Logging; - -namespace ModelBindingWebSite -{ - public class DefaultCalculator : ICalculator - { - private ILogger _logger; - - public DefaultCalculator(ILoggerFactory loggerFactory) - { - _logger = loggerFactory.CreateLogger(typeof(DefaultCalculator).FullName); - } - - public int Operation(char @operator, int left, int right) - { - switch (@operator) - { - case '+': return left + right; - case '-': return left - right; - case '*': return left * right; - case '/': return left / right; - default: - _logger.LogError("Unrecognized operator:" + @operator); - throw new InvalidOperationException(); - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/DefaultCalculatorContext.cs b/test/WebSites/ModelBindingWebSite/DefaultCalculatorContext.cs deleted file mode 100644 index 3fa3c84a7..000000000 --- a/test/WebSites/ModelBindingWebSite/DefaultCalculatorContext.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite -{ - public class DefaultCalculatorContext : CalculatorContext - { - public int Precision { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/FromNonExistantBinderAttribute.cs b/test/WebSites/ModelBindingWebSite/FromNonExistantBinderAttribute.cs deleted file mode 100644 index fb59ef193..000000000 --- a/test/WebSites/ModelBindingWebSite/FromNonExistantBinderAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Mvc.ModelBinding; - -namespace ModelBindingWebSite -{ - public class FromNonExistantBinderAttribute : Attribute, IBindingSourceMetadata - { - public BindingSource BindingSource - { - get - { - return BindingSource.Custom; - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/FromTestAttribute.cs b/test/WebSites/ModelBindingWebSite/FromTestAttribute.cs deleted file mode 100644 index a8c919afb..000000000 --- a/test/WebSites/ModelBindingWebSite/FromTestAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Mvc.ModelBinding; - -namespace ModelBindingWebSite -{ - public class FromTestAttribute : Attribute, IBindingSourceMetadata - { - public static readonly BindingSource TestBindingSource = new BindingSource( - "Test", - displayName: null, - isGreedy: true, - isFromRequest: true); - - public BindingSource BindingSource { get { return TestBindingSource; } } - - public object Value { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/ICalculator.cs b/test/WebSites/ModelBindingWebSite/ICalculator.cs deleted file mode 100644 index 756a12bc8..000000000 --- a/test/WebSites/ModelBindingWebSite/ICalculator.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite -{ - public interface ICalculator - { - int Operation(char @operator, int left, int right); - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/ITestService.cs b/test/WebSites/ModelBindingWebSite/ITestService.cs deleted file mode 100644 index 18671b6f7..000000000 --- a/test/WebSites/ModelBindingWebSite/ITestService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite -{ - public interface ITestService - { - bool Test(); - } -} diff --git a/test/WebSites/ModelBindingWebSite/ModelBindingWebSite.xproj b/test/WebSites/ModelBindingWebSite/ModelBindingWebSite.xproj deleted file mode 100644 index e4873b6c2..000000000 --- a/test/WebSites/ModelBindingWebSite/ModelBindingWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - ee1ab716-f102-4ca3-ad2c-214a44b459a0 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 49635 - - - \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/ModelMetadataExtensions.cs b/test/WebSites/ModelBindingWebSite/ModelMetadataExtensions.cs deleted file mode 100644 index 7cb421069..000000000 --- a/test/WebSites/ModelBindingWebSite/ModelMetadataExtensions.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ModelBinding; - -namespace ModelBindingWebSite -{ - /// - /// Extensions for . - /// - public static class ModelMetadataExtensions - { - /// - /// Gets the group name associated with given . - /// - /// The - /// Group name associated with given . - public static string GetGroupName(this ModelMetadata modelMetadata) - { - object groupName; - modelMetadata.AdditionalValues.TryGetValue(AdditionalValuesMetadataProvider.GroupNameKey, out groupName); - - return groupName as string; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Address.cs b/test/WebSites/ModelBindingWebSite/Models/Address.cs deleted file mode 100644 index 8b3f69fb8..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Address.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace ModelBindingWebSite.Models -{ - public class Address - { - public int Street { get; set; } - public string State { get; set; } - - [Range(10000, 99999)] - public int Zip { get; set; } - - public Country Country { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/BindingBehaviorModel.cs b/test/WebSites/ModelBindingWebSite/Models/BindingBehaviorModel.cs deleted file mode 100644 index 548a2477f..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/BindingBehaviorModel.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc.ModelBinding; - -namespace ModelBindingWebSite -{ - public class BindingBehaviorModel - { - [BindingBehavior(BindingBehavior.Never)] - public string BehaviourNeverProperty { get; set; } - - [BindingBehavior(BindingBehavior.Optional)] - public string BehaviourOptionalProperty { get; set; } - - [BindingBehavior(BindingBehavior.Required)] - public string BehaviourRequiredProperty { get; set; } - - [BindRequired] - public string BindRequiredProperty { get; set; } - - [BindNever] - public string BindNeverProperty { get; set; } - } -} diff --git a/test/WebSites/ModelBindingWebSite/Models/Book.cs b/test/WebSites/ModelBindingWebSite/Models/Book.cs deleted file mode 100644 index 4cbe74ecd..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Book.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Http; - -namespace ModelBindingWebSite.Models -{ - public class Book - { - public string Name { get; set; } - - public IFormFile File { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Company.cs b/test/WebSites/ModelBindingWebSite/Models/Company.cs deleted file mode 100644 index 7ef540457..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Company.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace ModelBindingWebSite.Models -{ - public class Company - { - public Department Department { get; set; } - - [FromTest] - public Person CEO { get; set; } - - public IList Employees { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Country.cs b/test/WebSites/ModelBindingWebSite/Models/Country.cs deleted file mode 100644 index 746d4bd1a..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Country.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace ModelBindingWebSite.Models -{ - public class Country - { - public string Name { get; set; } - - public City[] Cities { get; set; } - - public int[] StateCodes { get; set; } - } - - public class City - { - public string CityName { get; set; } - - public string CityCode { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Customer.cs b/test/WebSites/ModelBindingWebSite/Models/Customer.cs deleted file mode 100644 index 3cb2431d7..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Customer.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Models -{ - public class Customer : Person - { - public int Id { get; set; } - - [FromBody] - public Department Department { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/DataMemberRequiredModel.cs b/test/WebSites/ModelBindingWebSite/Models/DataMemberRequiredModel.cs deleted file mode 100644 index 369687230..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/DataMemberRequiredModel.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.Serialization; - -namespace ModelBindingWebSite -{ - [DataContract] - public class DataMemberRequiredModel - { - [DataMember] - public string ImplicitlyOptionalProperty { get; set; } - - [DataMember(IsRequired = false)] - public string ExplicitlyOptionalProperty { get; set; } - - [DataMember(IsRequired = true)] - public string RequiredProperty { get; set; } - } -} diff --git a/test/WebSites/ModelBindingWebSite/Models/Department.cs b/test/WebSites/ModelBindingWebSite/Models/Department.cs deleted file mode 100644 index 5d5c27110..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Department.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite.Models -{ - public class Department - { - // A single property marked with a binder metadata attribute makes it a binder metadata poco. - [FromTest] - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Document.cs b/test/WebSites/ModelBindingWebSite/Models/Document.cs deleted file mode 100644 index 716009376..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Document.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite.Models -{ - public class Document - { - [FromNonExistantBinder] - public string Version { get; set; } - - [FromNonExistantBinder] - public Document SubDocument { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Employee.cs b/test/WebSites/ModelBindingWebSite/Models/Employee.cs deleted file mode 100644 index a29f1ed61..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Employee.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - - -using System.ComponentModel.DataAnnotations; -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Models -{ - public class Employee : Person - { - public string Department { get; set; } - - public string Location { get; set; } - - [FromQuery(Name = "EmployeeId")] - [Range(1, 10000)] - public int Id { get; set; } - - [FromRoute(Name = "EmployeeTaxId")] - public int TaxId { get; set; } - - [FromForm(Name = "EmployeeSSN")] - public string SSN { get; set; } - - [ModelBinder(Name = "Alias")] - public string EmailAlias { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/EmployeeWithBinderMetadata.cs b/test/WebSites/ModelBindingWebSite/Models/EmployeeWithBinderMetadata.cs deleted file mode 100644 index 7c00a80c2..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/EmployeeWithBinderMetadata.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - - -namespace ModelBindingWebSite.Models -{ - public class EmployeeWithBinderMetadata : Employee - { - } - - public class DerivedEmployee : EmployeeWithBinderMetadata - { - - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/FileDetails.cs b/test/WebSites/ModelBindingWebSite/Models/FileDetails.cs deleted file mode 100644 index 3713da442..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/FileDetails.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite.Models -{ - public class FileDetails - { - public string Filename { get; set; } - - public string Content { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/LargeModelWithValidation.cs b/test/WebSites/ModelBindingWebSite/Models/LargeModelWithValidation.cs deleted file mode 100644 index 1cd5e25a9..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/LargeModelWithValidation.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace ModelBindingWebSite.Models -{ - public class LargeModelWithValidation - { - [Required] - public ModelWithValidation Field1 { get; set; } - - [Required] - public ModelWithValidation Field2 { get; set; } - - [Required] - public ModelWithValidation Field3 { get; set; } - - [Required] - public ModelWithValidation Field4 { get; set; } - - [Required] - public ModelWithValidation Field5 { get; set; } - - [Required] - public ModelWithValidation Field6 { get; set; } - - [Required] - public ModelWithValidation Field7 { get; set; } - - [Required] - public ModelWithValidation Field8 { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Line.cs b/test/WebSites/ModelBindingWebSite/Models/Line.cs deleted file mode 100644 index 437ed475b..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Line.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.DataAnnotations; - -namespace ModelBindingWebSite -{ - public struct Line - { - [Required] - public Point Start { get; set; } - - [Required] - public Point End { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/MixedUser_FromBody.cs b/test/WebSites/ModelBindingWebSite/Models/MixedUser_FromBody.cs deleted file mode 100644 index e2351bd03..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/MixedUser_FromBody.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Models -{ - public class User_FromBody - { - [FromRoute] - public Address HomeAddress { get; set; } - - [FromBody] - public Address OfficeAddress { get; set; } - - [FromQuery] - public Address ShippingAddress { get; set; } - - // Should get it from the first value provider which - // can provide values for this. - public Address DefaultAddress { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/MixedUser_FromForm.cs b/test/WebSites/ModelBindingWebSite/Models/MixedUser_FromForm.cs deleted file mode 100644 index c226b1ed0..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/MixedUser_FromForm.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Models -{ - public class User_FromForm - { - [FromRoute] - public Address HomeAddress { get; set; } - - [FromForm] - public Address OfficeAddress { get; set; } - - [FromQuery] - public Address ShippingAddress { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/ModelWithValidation.cs b/test/WebSites/ModelBindingWebSite/Models/ModelWithValidation.cs deleted file mode 100644 index 24933534e..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/ModelWithValidation.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace ModelBindingWebSite.Models -{ - public class ModelWithValidation - { - [Required] - public string Field1 { get; set; } - - [Required] - public string Field2 { get; set; } - - [Required] - public string Field3 { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/PeopleModel.cs b/test/WebSites/ModelBindingWebSite/Models/PeopleModel.cs deleted file mode 100644 index c6938a4c0..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/PeopleModel.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace ModelBindingWebSite.Models -{ - public class PeopleModel - { - public List People { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Person.cs b/test/WebSites/ModelBindingWebSite/Models/Person.cs deleted file mode 100644 index f241bb4fe..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Person.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace ModelBindingWebSite.Models -{ - public class Person - { - public string Name { get; set; } - - public int Age { get; set; } - - public Person Parent { get; set; } - - public List Dependents { get; set; } - - public Dictionary Attributes { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/PersonAddress.cs b/test/WebSites/ModelBindingWebSite/Models/PersonAddress.cs deleted file mode 100644 index 69325b599..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/PersonAddress.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace ModelBindingWebSite.Models -{ - public class PersonAddress - { - public List AddressLines { get; set; } - - public string ZipCode { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/PersonWithNoProperties.cs b/test/WebSites/ModelBindingWebSite/Models/PersonWithNoProperties.cs deleted file mode 100644 index 787cf9bf7..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/PersonWithNoProperties.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite.Models -{ - public class PersonWithNoProperties - { - public string Name; - } -} diff --git a/test/WebSites/ModelBindingWebSite/Models/Point.cs b/test/WebSites/ModelBindingWebSite/Models/Point.cs deleted file mode 100644 index e49b60979..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Point.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace ModelBindingWebSite -{ - public struct Point - { - [Required] - public int X { get; set; } - - [Required] - public int Y { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/Resident.cs b/test/WebSites/ModelBindingWebSite/Models/Resident.cs deleted file mode 100644 index ff305f979..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/Resident.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.Models -{ - public class Resident : Person - { - public IEnumerable
ShippingAddresses { get; set; } - - public Address HomeAddress { get; set; } - - [FromBody] - public Address OfficeAddress { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/StreetAddress.cs b/test/WebSites/ModelBindingWebSite/Models/StreetAddress.cs deleted file mode 100644 index e79c4db4b..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/StreetAddress.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite.Models -{ - public class StreetAddress - { - public string Line { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/User.cs b/test/WebSites/ModelBindingWebSite/Models/User.cs deleted file mode 100644 index 635a6caaf..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/User.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace ModelBindingWebSite.Models -{ - public class User - { - [Required] - public int Id { get; set; } - public int Key { get; set; } - - [Required] - public string RegisterationMonth { get; set; } - public string UserName { get; set; } - - public Address Address { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/UserPreference.cs b/test/WebSites/ModelBindingWebSite/Models/UserPreference.cs deleted file mode 100644 index 6b40ca6ab..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/UserPreference.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite.Models -{ - public class UserPreference - { - public int Id { get; set; } - - public bool Checked { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Models/UserWithAddress.cs b/test/WebSites/ModelBindingWebSite/Models/UserWithAddress.cs deleted file mode 100644 index 020b0985b..000000000 --- a/test/WebSites/ModelBindingWebSite/Models/UserWithAddress.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace ModelBindingWebSite.Models -{ - public class UserWithAddress - { - public List Addresses { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Result.cs b/test/WebSites/ModelBindingWebSite/Result.cs deleted file mode 100644 index b86d2c0cb..000000000 --- a/test/WebSites/ModelBindingWebSite/Result.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite -{ - public class Result - { - public object Value { get; set; } - - public string[] ModelStateErrors { get; set; } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Services/IVehicleService.cs b/test/WebSites/ModelBindingWebSite/Services/IVehicleService.cs deleted file mode 100644 index dc7cb0289..000000000 --- a/test/WebSites/ModelBindingWebSite/Services/IVehicleService.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using ModelBindingWebSite.ViewModels; - -namespace ModelBindingWebSite.Services -{ - public interface IVehicleService - { - void Update(int id, VehicleViewModel vehicle, string trackingId); - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Services/VehicleService.cs b/test/WebSites/ModelBindingWebSite/Services/VehicleService.cs deleted file mode 100644 index 7bd2aec42..000000000 --- a/test/WebSites/ModelBindingWebSite/Services/VehicleService.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using ModelBindingWebSite.ViewModels; - -namespace ModelBindingWebSite.Services -{ - public class VehicleService : IVehicleService - { - public void Update(int id, VehicleViewModel vehicle, string trackingId) - { - if (trackingId == null) - { - throw new ArgumentException(nameof(trackingId)); - } - - vehicle.LastUpdatedTrackingId = trackingId; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Startup.cs b/test/WebSites/ModelBindingWebSite/Startup.cs deleted file mode 100644 index e02921be9..000000000 --- a/test/WebSites/ModelBindingWebSite/Startup.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Mvc.ModelBinding.Validation; -using Microsoft.Extensions.DependencyInjection; -using ModelBindingWebSite.Models; -using ModelBindingWebSite.Services; - -namespace ModelBindingWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - // Add MVC services to the services container - services - .AddMvc(m => - { - m.MaxModelValidationErrors = 8; - m.ModelBinders.Insert(0, new TestBindingSourceModelBinder()); - - m.ModelMetadataDetailsProviders.Add(new ValidationExcludeFilter(typeof(Address))); - - // ModelMetadataController relies on additional values AdditionalValuesMetadataProvider provides. - m.ModelMetadataDetailsProviders.Add(new AdditionalValuesMetadataProvider()); - }) - .AddXmlDataContractSerializerFormatters(); - - services.AddSingleton(); - services.AddSingleton(); - - services.AddTransient(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseErrorReporter(); - - // Add MVC to the request pipeline - app.UseMvcWithDefaultRoute(); - } - } -} diff --git a/test/WebSites/ModelBindingWebSite/TestBindingSourceModelBinder.cs b/test/WebSites/ModelBindingWebSite/TestBindingSourceModelBinder.cs deleted file mode 100644 index 4f0931c5a..000000000 --- a/test/WebSites/ModelBindingWebSite/TestBindingSourceModelBinder.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding; -using Microsoft.AspNet.Mvc.ModelBinding.Metadata; - -namespace ModelBindingWebSite -{ - public class TestBindingSourceModelBinder : IModelBinder - { - public Task BindModelAsync(ModelBindingContext bindingContext) - { - var allowedBindingSource = bindingContext.BindingSource; - if (allowedBindingSource == null || - !allowedBindingSource.CanAcceptDataFrom(FromTestAttribute.TestBindingSource)) - { - return ModelBindingResult.NoResultAsync; - } - - var attributes = ((DefaultModelMetadata)bindingContext.ModelMetadata).Attributes; - var metadata = attributes.Attributes.OfType().First(); - var model = metadata.Value; - if (!IsSimpleType(bindingContext.ModelType)) - { - model = Activator.CreateInstance(bindingContext.ModelType); - return ModelBindingResult.SuccessAsync(bindingContext.ModelName, model); - } - - return ModelBindingResult.FailedAsync(bindingContext.ModelName); - } - - private bool IsSimpleType(Type type) - { - return type.GetTypeInfo().IsPrimitive || - type.Equals(typeof(decimal)) || - type.Equals(typeof(string)) || - type.Equals(typeof(DateTime)) || - type.Equals(typeof(Guid)) || - type.Equals(typeof(DateTimeOffset)) || - type.Equals(typeof(TimeSpan)); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/TestService.cs b/test/WebSites/ModelBindingWebSite/TestService.cs deleted file mode 100644 index 4821d97c1..000000000 --- a/test/WebSites/ModelBindingWebSite/TestService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace ModelBindingWebSite -{ - public class TestService : ITestService - { - public bool Test() => true; - } -} diff --git a/test/WebSites/ModelBindingWebSite/ViewModels/DealerViewModel.cs b/test/WebSites/ModelBindingWebSite/ViewModels/DealerViewModel.cs deleted file mode 100644 index 2bd87e634..000000000 --- a/test/WebSites/ModelBindingWebSite/ViewModels/DealerViewModel.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace ModelBindingWebSite.ViewModels -{ - public class DealerViewModel - { - private const string DefaultCustomerServiceNumber = "999-99-0000"; - - public int Id { get; set; } - - public string Name { get; set; } - - [Required] - public string Location { get; set; } - - [DataType(DataType.PhoneNumber)] - public string Phone { get; set; } = DefaultCustomerServiceNumber; - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/ViewModels/VehicleViewModel.cs b/test/WebSites/ModelBindingWebSite/ViewModels/VehicleViewModel.cs deleted file mode 100644 index 02e6f072d..000000000 --- a/test/WebSites/ModelBindingWebSite/ViewModels/VehicleViewModel.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; - -namespace ModelBindingWebSite.ViewModels -{ - public class VehicleViewModel : IValidatableObject - { - // Placed using default Order (10000). - [Required] - [StringLength(8)] - public string Vin { get; set; } - - [Display(Order = 1, GroupName = "MakeAndModelGroup")] - public string Make { get; set; } - - [Display(Order = 0, GroupName = "MakeAndModelGroup")] - public string Model { get; set; } - - // Placed using default Order (10000). - [Range(1980, 2034)] - [CustomValidation(typeof(VehicleViewModel), nameof(ValidateYear))] - public int Year { get; set; } - - [Display(Order = 20000)] - [Required] - [MaxLength(10)] - public DateTimeOffset[] InspectedDates { get; set; } - - [Display(Order = 20000, GroupName = "TrackingIdGroup")] - public string LastUpdatedTrackingId { get; set; } - - public IEnumerable Validate(ValidationContext validationContext) - { - if (InspectedDates.Any(d => d.Year > Year)) - { - yield return new ValidationResult( - "Inspection date cannot be later than year of manufacture.", - new[] { nameof(InspectedDates) }); - } - } - - public static ValidationResult ValidateYear(int year) - { - if (year > DateTime.UtcNow.Year) - { - return new ValidationResult("Year is invalid"); - } - - return ValidationResult.Success; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/ViewModels/VehicleWithDealerViewModel.cs b/test/WebSites/ModelBindingWebSite/ViewModels/VehicleWithDealerViewModel.cs deleted file mode 100644 index 7ae0c9b8b..000000000 --- a/test/WebSites/ModelBindingWebSite/ViewModels/VehicleWithDealerViewModel.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using Microsoft.AspNet.Mvc; - -namespace ModelBindingWebSite.ViewModels -{ - public class VehicleWithDealerViewModel : IValidatableObject - { - [Required] - public DealerViewModel Dealer { get; set; } - - [Required] - [FromBody] - public VehicleViewModel Vehicle { get; set; } - - [FromHeader(Name = "X-TrackingId")] - public string TrackingId { get; set; } = "default-tracking-id"; - - public IEnumerable Validate(ValidationContext validationContext) - { - if (!IsValidMakeForRegion(Vehicle.Make, Dealer.Location)) - { - yield return new ValidationResult("Make is invalid for region."); - } - } - - public bool IsValidMakeForRegion(string make, string region) - { - switch (make) - { - case "Acme": - return region == "NW" || "region" == "South Central"; - case "FastCars": - return region != "Central"; - } - - return true; - } - } -} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Views/Vehicle/Details.cshtml b/test/WebSites/ModelBindingWebSite/Views/Vehicle/Details.cshtml deleted file mode 100644 index b5886ddb4..000000000 --- a/test/WebSites/ModelBindingWebSite/Views/Vehicle/Details.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -@model ModelBindingWebSite.ViewModels.VehicleViewModel - -

Vehicle details

-
- @Html.DisplayFor(m => m) - @* DisplayFor ignores properties in complex objects that don't have simple types. Add the collection explicitly. *@ -
- @Html.NameFor(m => m.InspectedDates) -
-
- @Html.DisplayFor(m => m.InspectedDates) -
-
\ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Views/Vehicle/Edit.cshtml b/test/WebSites/ModelBindingWebSite/Views/Vehicle/Edit.cshtml deleted file mode 100644 index 13bde7767..000000000 --- a/test/WebSites/ModelBindingWebSite/Views/Vehicle/Edit.cshtml +++ /dev/null @@ -1,19 +0,0 @@ -@model ModelBindingWebSite.ViewModels.VehicleViewModel - -
- @using (Html.BeginForm()) - { - @Html.ValidationSummary() - @Html.EditorFor(m => m) - - @* EditorFor ignores properties in complex objects that don't have simple types. Add the collection explicitly. *@ -
- @Html.LabelFor(m => m.InspectedDates) -
-
- @Html.EditorFor(m => m.InspectedDates) -
- - - } -
\ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateSuccessful.cshtml b/test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateSuccessful.cshtml deleted file mode 100644 index 402b26961..000000000 --- a/test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateSuccessful.cshtml +++ /dev/null @@ -1,26 +0,0 @@ -@model ModelBindingWebSite.ViewModels.VehicleWithDealerViewModel - -
-
    -
  • - Vin: @Html.DisplayFor(m => m.Vehicle.Vin) -
  • -
  • - Inspected Dates: @Html.DisplayFor(m => m.Vehicle.InspectedDates) -
  • -
-
-
-
    -
  • - Dealer: @Html.DisplayFor(m => m.Dealer.Id) -
  • -
  • - Phone: @Html.DisplayFor(m => m.Dealer.Phone) -
  • -
-
- -
-Tracked by @Model.TrackingId -
diff --git a/test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateVehicle.cshtml b/test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateVehicle.cshtml deleted file mode 100644 index d4bb27c70..000000000 --- a/test/WebSites/ModelBindingWebSite/Views/Vehicle/UpdateVehicle.cshtml +++ /dev/null @@ -1,20 +0,0 @@ -@model ModelBindingWebSite.ViewModels.VehicleWithDealerViewModel - -
- @Model.Dealer.Name - @Model.Dealer.Location - @Html.HiddenFor(m => m.Dealer.Id) -
-@Html.ValidationSummary(excludePropertyErrors: true) -@using (Html.BeginForm()) -{ -
- @Html.TextBoxFor(m => m.Vehicle.Vin) - @Html.ValidationMessageFor(m => m.Vehicle.Vin) -
- -
- @Html.EditorFor(m => m.Vehicle.Year) - @Html.ValidationMessageFor(m => m.Vehicle.Year) -
-} \ No newline at end of file diff --git a/test/WebSites/ModelBindingWebSite/project.json b/test/WebSites/ModelBindingWebSite/project.json deleted file mode 100644 index 47c7af0a1..000000000 --- a/test/WebSites/ModelBindingWebSite/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/ModelBindingWebSite/readme.md b/test/WebSites/ModelBindingWebSite/readme.md deleted file mode 100644 index d89b530dc..000000000 --- a/test/WebSites/ModelBindingWebSite/readme.md +++ /dev/null @@ -1,6 +0,0 @@ -ModelBindingWebSite -=== - -This web site illustrates how to use and configure various knobs of model binding to let the model binding -system bind action parameters to the values which are present in the request. The website also uses model validation -to validate the models created using model binding. diff --git a/test/WebSites/ModelBindingWebSite/wwwroot/HelloWorld.htm b/test/WebSites/ModelBindingWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/ModelBindingWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_HomeController.cs b/test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_HomeController.cs deleted file mode 100644 index a966f7566..000000000 --- a/test/WebSites/RazorEmbeddedViewsWebSite/Controllers/RazorEmbeddedViews_HomeController.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; - -namespace RazorEmbeddedViewsWebSite -{ - public class RazorEmbeddedViews_HomeController : Controller - { - public IActionResult Index() - { - return View(); - } - } -} \ No newline at end of file diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/project.json b/test/WebSites/RazorEmbeddedViewsWebSite/project.json deleted file mode 100644 index 02db5e2ad..000000000 --- a/test/WebSites/RazorEmbeddedViewsWebSite/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "commands": { - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000" - }, - "resource": "EmbeddedResources/**", - "dependencies": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.FileProviders.Embedded": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - }, - "webroot": "wwwroot" -} diff --git a/test/WebSites/RazorEmbeddedViewsWebSite/wwwroot/HelloWorld.htm b/test/WebSites/RazorEmbeddedViewsWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e..000000000 --- a/test/WebSites/RazorEmbeddedViewsWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld