From 59824dc7be8e69202d15993a547f5d3a408a8aeb Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Sun, 13 Dec 2015 21:57:30 -0800 Subject: [PATCH] MVC functional test cleanup (part 1) - #3612 subpart 2 of 2 - merge `ActionConstraintsWebSite`, `AntiforgeryTokenWebSite` and `ContentNegotiationWebSite` into `BasicWebSite` - remove tests depending on `ErrorReporterMiddleware` in merged sites; not used in `BasicWebSite` - delete `CompositeViewEngineWebSite`, `Microsoft.AspNet.Mvc.ViewEngines.CompositeViewEngineTest` covers cases - delete `CorsMiddlewareWebsite`, soon to be in Cors repo (see aspnet/CORS#57) - remove `SendFileMiddleware` from FilesWebSite, unused there --- Mvc.sln | 73 -------- .../AntiforgeryTests.cs | 172 ++---------------- .../CompositeViewEngineTests.cs | 39 ---- .../ConsumesAttributeTests.cs | 33 +--- .../ContentNegotiationTest.cs | 25 +-- .../CorsMiddlewareTests.cs | 100 ---------- .../OutputFormatterTest.cs | 4 +- .../project.json | 5 - .../ActionConstraintsWebSite.xproj | 18 -- .../ActionConstraintsWebSite/Startup.cs | 34 ---- .../ActionConstraintsWebSite/project.json | 19 -- .../ActionConstraintsWebSite/readme.md | 4 - .../wwwroot/HelloWorld.htm | 1 - .../AntiforgeryTokenWebSite.xproj | 18 -- .../Controllers/HomeController.cs | 16 -- .../AntiforgeryTokenWebSite/Startup.cs | 30 --- .../Views/Home/MyView.cshtml | 3 - .../Views/Shared/_LoginPartial.cshtml | 3 - .../AntiforgeryTokenWebSite/project.json | 18 -- .../AntiforgeryTokenWebSite/readme.md | 5 - .../wwwroot/HelloWorld.htm | 1 - ...mesAttribute_NoFallBackActionController.cs | 3 +- ...onsumesAttribute_OveridesBaseController.cs | 3 +- .../ConsumesAttribute_OveridesController.cs | 3 +- ...ConsumesAttribute_PassThroughController.cs | 4 +- ...sAttribute_WithFallbackActionController.cs | 4 +- .../Controllers/AntiforgeryController.cs} | 22 ++- .../ContentNegotiationController.cs} | 5 +- .../FallbackOnTypeBasedMatchController.cs | 5 +- .../FormatFilterController.cs | 3 +- .../NoContentController.cs | 2 +- ...oNotTreatNullValueAsNoContentController.cs | 2 +- .../NoProducesContentOnClassController.cs | 3 +- .../ContentNegotiation}/NormalController.cs | 4 +- .../ProducesContentBaseController.cs | 3 +- .../ProducesContentOnClassController.cs | 3 +- .../ProducesJsonController.cs} | 4 +- ...oducesWithMediaTypeParametersController.cs | 5 +- .../TextPlainController.cs | 2 +- .../Formatters}/CustomFormatter.cs | 2 +- .../Formatters}/PlainTextFormatter.cs | 2 +- .../Formatters}/VCardFormatter_V3.cs | 4 +- .../Formatters}/VCardFormatter_V4.cs | 4 +- .../Models/Contact.cs | 8 +- .../BasicWebSite/Models/GenderType.cs | 11 ++ .../Models/LoginViewModel.cs} | 2 +- .../Models/Product.cs | 2 +- .../Models/Product_Json.cs | 2 +- .../Models/Product_Xml.cs | 2 +- .../Models/Product_text.cs | 2 +- .../Models/User.cs | 2 +- test/WebSites/BasicWebSite/Startup.cs | 9 +- .../Views/Antiforgery}/FlushAsyncLogin.cshtml | 10 +- .../Views/Antiforgery/Index.cshtml | 4 + .../Views/Antiforgery}/Login.cshtml | 10 +- .../Antiforgery}/_FlushAsyncLayout.cshtml | 4 +- .../Views/Antiforgery}/_Layout.cshtml | 4 +- .../Views/Antiforgery/_LoginPartial.cshtml | 3 + test/WebSites/BasicWebSite/project.json | 17 +- .../BasicWebSite/wwwroot/HelloWorld.htm | 1 - .../CompositeViewEngineWebSite.xproj | 18 -- .../HomeController.cs | 20 -- .../CompositeViewEngineWebSite/Startup.cs | 31 ---- .../TestPartialView.cs | 19 -- .../CompositeViewEngineWebSite/TestView.cs | 19 -- .../TestViewEngine.cs | 31 ---- .../Views/Home/Index.cshtml | 1 - .../CompositeViewEngineWebSite/project.json | 18 -- .../CompositeViewEngineWebSite/readme.md | 4 - .../wwwroot/HelloWorld.htm | 1 - .../ContentNegotiationWebSite.xproj | 18 -- .../ContentNegotiationWebSite/Startup.cs | 32 ---- .../ContentNegotiationWebSite/project.json | 19 -- .../ContentNegotiationWebSite/readme.md | 5 - .../wwwroot/HelloWorld.htm | 1 - .../Controllers/BlogController.cs | 16 -- .../CorsMiddlewareWebSite.xproj | 18 -- .../WebSites/CorsMiddlewareWebSite/Startup.cs | 24 --- .../CorsMiddlewareWebSite/project.json | 20 -- test/WebSites/CorsMiddlewareWebSite/readme.md | 4 - .../wwwroot/HelloWorld.htm | 1 - .../FilesWebSite/SendFileMiddleware.cs | 73 -------- test/WebSites/FilesWebSite/Startup.cs | 2 - 83 files changed, 142 insertions(+), 1059 deletions(-) delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/CompositeViewEngineTests.cs delete mode 100644 test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs delete mode 100644 test/WebSites/ActionConstraintsWebSite/ActionConstraintsWebSite.xproj delete mode 100644 test/WebSites/ActionConstraintsWebSite/Startup.cs delete mode 100644 test/WebSites/ActionConstraintsWebSite/project.json delete mode 100644 test/WebSites/ActionConstraintsWebSite/readme.md delete mode 100644 test/WebSites/ActionConstraintsWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/AntiforgeryTokenWebSite.xproj delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/Controllers/HomeController.cs delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/Startup.cs delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/Views/Home/MyView.cshtml delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_LoginPartial.cshtml delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/project.json delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/readme.md delete mode 100644 test/WebSites/AntiforgeryTokenWebSite/wwwroot/HelloWorld.htm rename test/WebSites/{ActionConstraintsWebSite/Controllers => BasicWebSite/Controllers/ActionConstraints}/ConsumesAttribute_NoFallBackActionController.cs (89%) rename test/WebSites/{ActionConstraintsWebSite/Controllers => BasicWebSite/Controllers/ActionConstraints}/ConsumesAttribute_OveridesBaseController.cs (92%) rename test/WebSites/{ActionConstraintsWebSite/Controllers => BasicWebSite/Controllers/ActionConstraints}/ConsumesAttribute_OveridesController.cs (88%) rename test/WebSites/{ActionConstraintsWebSite/Controllers => BasicWebSite/Controllers/ActionConstraints}/ConsumesAttribute_PassThroughController.cs (85%) rename test/WebSites/{ActionConstraintsWebSite/Controllers => BasicWebSite/Controllers/ActionConstraints}/ConsumesAttribute_WithFallbackActionController.cs (90%) rename test/WebSites/{AntiforgeryTokenWebSite/Controllers/AccountController.cs => BasicWebSite/Controllers/AntiforgeryController.cs} (70%) rename test/WebSites/{ContentNegotiationWebSite/Controllers/HomeController.cs => BasicWebSite/Controllers/ContentNegotiation/ContentNegotiationController.cs} (86%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/FallbackOnTypeBasedMatchController.cs (95%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/FormatFilterController.cs (90%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/NoContentController.cs (94%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/NoContentDoNotTreatNullValueAsNoContentController.cs (95%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/NoProducesContentOnClassController.cs (92%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/NormalController.cs (94%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/ProducesContentBaseController.cs (94%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/ProducesContentOnClassController.cs (95%) rename test/WebSites/{ContentNegotiationWebSite/Controllers/JsonResultController.cs => BasicWebSite/Controllers/ContentNegotiation/ProducesJsonController.cs} (79%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/ProducesWithMediaTypeParametersController.cs (91%) rename test/WebSites/{ContentNegotiationWebSite/Controllers => BasicWebSite/Controllers/ContentNegotiation}/TextPlainController.cs (95%) rename test/WebSites/{ContentNegotiationWebSite => BasicWebSite/Formatters}/CustomFormatter.cs (97%) rename test/WebSites/{ContentNegotiationWebSite => BasicWebSite/Formatters}/PlainTextFormatter.cs (97%) rename test/WebSites/{ContentNegotiationWebSite => BasicWebSite/Formatters}/VCardFormatter_V3.cs (94%) rename test/WebSites/{ContentNegotiationWebSite => BasicWebSite/Formatters}/VCardFormatter_V4.cs (95%) rename test/WebSites/{ContentNegotiationWebSite => BasicWebSite}/Models/Contact.cs (85%) create mode 100644 test/WebSites/BasicWebSite/Models/GenderType.cs rename test/WebSites/{AntiforgeryTokenWebSite/Models/LoginViewModels.cs => BasicWebSite/Models/LoginViewModel.cs} (94%) rename test/WebSites/{ActionConstraintsWebSite => BasicWebSite}/Models/Product.cs (91%) rename test/WebSites/{ActionConstraintsWebSite => BasicWebSite}/Models/Product_Json.cs (86%) rename test/WebSites/{ActionConstraintsWebSite => BasicWebSite}/Models/Product_Xml.cs (85%) rename test/WebSites/{ActionConstraintsWebSite => BasicWebSite}/Models/Product_text.cs (86%) rename test/WebSites/{ContentNegotiationWebSite => BasicWebSite}/Models/User.cs (91%) rename test/WebSites/{AntiforgeryTokenWebSite/Views/Account => BasicWebSite/Views/Antiforgery}/FlushAsyncLogin.cshtml (82%) create mode 100644 test/WebSites/BasicWebSite/Views/Antiforgery/Index.cshtml rename test/WebSites/{AntiforgeryTokenWebSite/Views/Account => BasicWebSite/Views/Antiforgery}/Login.cshtml (85%) rename test/WebSites/{AntiforgeryTokenWebSite/Views/Shared => BasicWebSite/Views/Antiforgery}/_FlushAsyncLayout.cshtml (54%) rename test/WebSites/{AntiforgeryTokenWebSite/Views/Shared => BasicWebSite/Views/Antiforgery}/_Layout.cshtml (83%) create mode 100644 test/WebSites/BasicWebSite/Views/Antiforgery/_LoginPartial.cshtml delete mode 100644 test/WebSites/BasicWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/CompositeViewEngineWebSite/CompositeViewEngineWebSite.xproj delete mode 100644 test/WebSites/CompositeViewEngineWebSite/HomeController.cs delete mode 100644 test/WebSites/CompositeViewEngineWebSite/Startup.cs delete mode 100644 test/WebSites/CompositeViewEngineWebSite/TestPartialView.cs delete mode 100644 test/WebSites/CompositeViewEngineWebSite/TestView.cs delete mode 100644 test/WebSites/CompositeViewEngineWebSite/TestViewEngine.cs delete mode 100644 test/WebSites/CompositeViewEngineWebSite/Views/Home/Index.cshtml delete mode 100644 test/WebSites/CompositeViewEngineWebSite/project.json delete mode 100644 test/WebSites/CompositeViewEngineWebSite/readme.md delete mode 100644 test/WebSites/CompositeViewEngineWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/ContentNegotiationWebSite/ContentNegotiationWebSite.xproj delete mode 100644 test/WebSites/ContentNegotiationWebSite/Startup.cs delete mode 100644 test/WebSites/ContentNegotiationWebSite/project.json delete mode 100644 test/WebSites/ContentNegotiationWebSite/readme.md delete mode 100644 test/WebSites/ContentNegotiationWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/CorsMiddlewareWebSite/Controllers/BlogController.cs delete mode 100644 test/WebSites/CorsMiddlewareWebSite/CorsMiddlewareWebSite.xproj delete mode 100644 test/WebSites/CorsMiddlewareWebSite/Startup.cs delete mode 100644 test/WebSites/CorsMiddlewareWebSite/project.json delete mode 100644 test/WebSites/CorsMiddlewareWebSite/readme.md delete mode 100644 test/WebSites/CorsMiddlewareWebSite/wwwroot/HelloWorld.htm delete mode 100644 test/WebSites/FilesWebSite/SendFileMiddleware.cs diff --git a/Mvc.sln b/Mvc.sln index bded2831d8..611eb28d1a 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -44,8 +44,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ContentNegotiationWebSite", "test\WebSites\ContentNegotiationWebSite\ContentNegotiationWebSite.xproj", "{C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FiltersWebSite", "test\WebSites\FiltersWebSite\FiltersWebSite.xproj", "{1976AC4A-FEA4-4587-A158-D9F79736D2B6}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApiExplorerWebSite", "test\WebSites\ApiExplorerWebSite\ApiExplorerWebSite.xproj", "{61061528-071E-424E-965A-07BCC2F02672}" @@ -74,14 +72,10 @@ 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}") = "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}") = "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}") = "XmlFormattersWebSite", "test\WebSites\XmlFormattersWebSite\XmlFormattersWebSite.xproj", "{C3123A70-41C4-4122-AD1C-D35DF8958DD7}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ControllersFromServicesWebSite", "test\WebSites\ControllersFromServicesWebSite\ControllersFromServicesWebSite.xproj", "{983741B2-4424-4ED1-9B03-7675A67230C8}" @@ -94,8 +88,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.TestCo 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}") = "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}" @@ -106,8 +98,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}") = "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}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ViewFeatures", "src\Microsoft.AspNet.Mvc.ViewFeatures\Microsoft.AspNet.Mvc.ViewFeatures.xproj", "{3F8B8FC1-9FE4-4788-8991-367113E8D7AD}" @@ -302,16 +292,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 - {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 - {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Debug|x86.ActiveCfg = Debug|Any CPU - {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Release|Any CPU.Build.0 = Release|Any CPU - {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {C6E5AFFA-890A-448F-8DE3-878B1D3C9FC7}.Release|x86.ActiveCfg = Release|Any CPU {1976AC4A-FEA4-4587-A158-D9F79736D2B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1976AC4A-FEA4-4587-A158-D9F79736D2B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {1976AC4A-FEA4-4587-A158-D9F79736D2B6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -452,18 +432,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 - {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 - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Debug|x86.ActiveCfg = Debug|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Debug|x86.Build.0 = Debug|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|Any CPU.Build.0 = Release|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|x86.ActiveCfg = Release|Any CPU - {A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|x86.Build.0 = Release|Any CPU {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -488,18 +456,6 @@ Global {AD545A5B-2BA5-4314-88AC-FC2ACF2CC718}.Release|Mixed Platforms.Build.0 = Release|Any CPU {AD545A5B-2BA5-4314-88AC-FC2ACF2CC718}.Release|x86.ActiveCfg = Release|Any CPU {AD545A5B-2BA5-4314-88AC-FC2ACF2CC718}.Release|x86.Build.0 = Release|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Debug|x86.ActiveCfg = Debug|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Debug|x86.Build.0 = Debug|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Release|Any CPU.Build.0 = Release|Any CPU - {AF210F69-9D31-43AF-AC3A-CD366E252218}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {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 {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 @@ -571,18 +527,6 @@ Global {94BA134D-04B3-48AA-BA55-5A4DB8640F2D}.Release|Mixed Platforms.Build.0 = Release|Any CPU {94BA134D-04B3-48AA-BA55-5A4DB8640F2D}.Release|x86.ActiveCfg = Release|Any CPU {94BA134D-04B3-48AA-BA55-5A4DB8640F2D}.Release|x86.Build.0 = Release|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Debug|x86.ActiveCfg = Debug|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Debug|x86.Build.0 = Debug|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Release|Any CPU.Build.0 = Release|Any CPU - {B42D4844-FFF8-4EC2-88D1-3AE95234D9EB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {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 {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 @@ -643,18 +587,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 - {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 - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Debug|x86.ActiveCfg = Debug|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Debug|x86.Build.0 = Debug|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Release|Any CPU.Build.0 = Release|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Release|x86.ActiveCfg = Release|Any CPU - {A353B17E-A940-4CE8-8BF9-179E24A9041F}.Release|x86.Build.0 = Release|Any CPU {F21E225B-190B-4DAA-8B0A-05986D231F56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F21E225B-190B-4DAA-8B0A-05986D231F56}.Debug|Any CPU.Build.0 = Debug|Any CPU {F21E225B-190B-4DAA-8B0A-05986D231F56}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -939,7 +871,6 @@ Global {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} - {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} {C6304029-78C8-4604-99BE-2078DCA1DD36} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} @@ -954,23 +885,19 @@ 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} - {A853B2BA-4449-4908-A416-5A3C027FC22B} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {920F8A0E-6F7D-4BBE-84FF-840B89099BE6} = {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} {C3123A70-41C4-4122-AD1C-D35DF8958DD7} = {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} {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} {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} - {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} {3FC8D9D6-9352-43A3-8E81-422F270085B7} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiforgeryTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiforgeryTests.cs index 67c05676d1..6256155a70 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiforgeryTests.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiforgeryTests.cs @@ -10,9 +10,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class AntiforgeryTests : IClassFixture> + public class AntiforgeryTests : IClassFixture> { - public AntiforgeryTests(MvcTestFixture fixture) + public AntiforgeryTests(MvcTestFixture fixture) { Client = fixture.Client; } @@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public async Task MultipleAFTokensWithinTheSamePage_GeneratesASingleCookieToken() { // Arrange & Act - var response = await Client.GetAsync("http://localhost/Account/Login"); + var response = await Client.GetAsync("http://localhost/Antiforgery/Login"); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -42,15 +42,17 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests { // Arrange // Do a get request. - var getResponse = await Client.GetAsync("http://localhost/Account/Login"); + var getResponse = await Client.GetAsync("http://localhost/Antiforgery/Login"); var responseBody = await getResponse.Content.ReadAsStringAsync(); // Get the AF token for the second login. If the cookies are generated twice(i.e are different), // this AF token will not work with the first cookie. - var formToken = AntiforgeryTestHelper.RetrieveAntiforgeryToken(responseBody, "Account/UseFacebookLogin"); + var formToken = AntiforgeryTestHelper.RetrieveAntiforgeryToken( + responseBody, + "/Antiforgery/UseFacebookLogin"); var cookieToken = AntiforgeryTestHelper.RetrieveAntiforgeryCookie(getResponse); - var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Account/Login"); + var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Antiforgery/Login"); request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value); var nameValueCollection = new List> { @@ -69,159 +71,11 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Equal("OK", await response.Content.ReadAsStringAsync()); } - [Fact] - public async Task InvalidCookieToken_Throws() - { - // Arrange - var getResponse = await Client.GetAsync("http://localhost/Account/Login"); - var responseBody = await getResponse.Content.ReadAsStringAsync(); - var formToken = AntiforgeryTestHelper.RetrieveAntiforgeryToken(responseBody, "Account/Login"); - - var cookieToken = AntiforgeryTestHelper.RetrieveAntiforgeryCookie(getResponse); - var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Account/Login"); - request.Headers.Add("Cookie", cookieToken.Key + "=invalidCookie"); - - var nameValueCollection = new List> - { - new KeyValuePair("__RequestVerificationToken", formToken), - new KeyValuePair("UserName", "abra"), - new KeyValuePair("Password", "cadabra"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var exception = response.GetServerException(); - Assert.Equal("The antiforgery token could not be decrypted.", exception.ExceptionMessage); - } - - [Fact] - public async Task InvalidFormToken_Throws() - { - // Arrange - var getResponse = await Client.GetAsync("http://localhost/Account/Login"); - var responseBody = await getResponse.Content.ReadAsStringAsync(); - var cookieToken = AntiforgeryTestHelper.RetrieveAntiforgeryCookie(getResponse); - var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Account/Login"); - var formToken = "adsad"; - request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value); - var nameValueCollection = new List> - { - new KeyValuePair("__RequestVerificationToken", formToken), - new KeyValuePair("UserName", "abra"), - new KeyValuePair("Password", "cadabra"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var exception = response.GetServerException(); - Assert.Equal("The antiforgery token could not be decrypted.", exception.ExceptionMessage); - } - - [Fact] - public async Task IncompatibleCookieToken_Throws() - { - // Arrange - // do a get response. - // We do two requests to get two different sets of antiforgery cookie and token values. - var getResponse1 = await Client.GetAsync("http://localhost/Account/Login"); - var responseBody1 = await getResponse1.Content.ReadAsStringAsync(); - var formToken1 = AntiforgeryTestHelper.RetrieveAntiforgeryToken(responseBody1, "Account/Login"); - - var getResponse2 = await Client.GetAsync("http://localhost/Account/Login"); - var responseBody2 = await getResponse2.Content.ReadAsStringAsync(); - var cookieToken2 = AntiforgeryTestHelper.RetrieveAntiforgeryCookie(getResponse2); - - var cookieToken = cookieToken2.Value; - var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Account/Login"); - request.Headers.Add("Cookie", string.Format("{0}={1}", cookieToken2.Key, cookieToken2.Value)); - var formToken = formToken1; - var nameValueCollection = new List> - { - new KeyValuePair("__RequestVerificationToken", formToken), - new KeyValuePair("UserName", "abra"), - new KeyValuePair("Password", "cadabra"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var exception = response.GetServerException(); - Assert.Equal("The antiforgery cookie token and form field token do not match.", exception.ExceptionMessage); - } - - [Fact] - public async Task MissingCookieToken_Throws() - { - // Arrange - // do a get response. - var getResponse = await Client.GetAsync("http://localhost/Account/Login"); - var responseBody = await getResponse.Content.ReadAsStringAsync(); - var formToken = AntiforgeryTestHelper.RetrieveAntiforgeryToken(responseBody, "Account/Login"); - var cookieTokenKey = AntiforgeryTestHelper.RetrieveAntiforgeryCookie(getResponse).Key; - - var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Account/Login"); - var nameValueCollection = new List> - { - new KeyValuePair("__RequestVerificationToken", formToken), - new KeyValuePair("UserName", "abra"), - new KeyValuePair("Password", "cadabra"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var exception = response.GetServerException(); - Assert.Equal( - "The required antiforgery cookie \"" + cookieTokenKey + "\" is not present.", - exception.ExceptionMessage); - } - - [Fact] - public async Task MissingAFToken_Throws() - { - // Arrange - var getResponse = await Client.GetAsync("http://localhost/Account/Login"); - var responseBody = await getResponse.Content.ReadAsStringAsync(); - var cookieToken = AntiforgeryTestHelper.RetrieveAntiforgeryCookie(getResponse); - - var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Account/Login"); - request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value); - var nameValueCollection = new List> - { - new KeyValuePair("UserName", "abra"), - new KeyValuePair("Password", "cadabra"), - }; - - request.Content = new FormUrlEncodedContent(nameValueCollection); - - // Act - var response = await Client.SendAsync(request); - - // Assert - var exception = response.GetServerException(); - Assert.Equal("The required antiforgery form field \"__RequestVerificationToken\" is not present.", - exception.ExceptionMessage); - } - [Fact] public async Task SetCookieAndHeaderBeforeFlushAsync_GeneratesCookieTokenAndHeader() { // Arrange & Act - var response = await Client.GetAsync("http://localhost/Account/FlushAsyncLogin"); + var response = await Client.GetAsync("http://localhost/Antiforgery/FlushAsyncLogin"); // Assert var header = Assert.Single(response.Headers.GetValues("X-Frame-Options")); @@ -236,13 +90,15 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests { // Arrange // do a get response. - var getResponse = await Client.GetAsync("http://localhost/Account/FlushAsyncLogin"); + var getResponse = await Client.GetAsync("http://localhost/Antiforgery/FlushAsyncLogin"); var responseBody = await getResponse.Content.ReadAsStringAsync(); - var formToken = AntiforgeryTestHelper.RetrieveAntiforgeryToken(responseBody, "Account/FlushAsyncLogin"); + var formToken = AntiforgeryTestHelper.RetrieveAntiforgeryToken( + responseBody, + "Antiforgery/FlushAsyncLogin"); var cookieToken = AntiforgeryTestHelper.RetrieveAntiforgeryCookie(getResponse); - var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Account/FlushAsyncLogin"); + var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Antiforgery/FlushAsyncLogin"); request.Headers.Add("Cookie", cookieToken.Key + "=" + cookieToken.Value); var nameValueCollection = new List> { diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/CompositeViewEngineTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/CompositeViewEngineTests.cs deleted file mode 100644 index 27c00ee7d9..0000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/CompositeViewEngineTests.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.Net.Http; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class CompositeViewEngineTests : IClassFixture> - { - public CompositeViewEngineTests(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Fact] - public async Task CompositeViewEngine_FindsPartialViewsAcrossAllEngines() - { - // Arrange & Act - var body = await Client.GetStringAsync("http://localhost/"); - - // Assert - Assert.Equal("Hello world", body.Trim()); - } - - [Fact] - public async Task CompositeViewEngine_FindsViewsAcrossAllEngines() - { - // Arrange & Act - var body = await Client.GetStringAsync("http://localhost/Home/TestView"); - - // Assert - Assert.Equal("Content from test view", body.Trim()); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ConsumesAttributeTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ConsumesAttributeTests.cs index c1647499b2..888d50e17b 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ConsumesAttributeTests.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/ConsumesAttributeTests.cs @@ -5,7 +5,7 @@ using System.Net; using System.Net.Http; using System.Text; using System.Threading.Tasks; -using ActionConstraintsWebSite; +using BasicWebSite.Models; using Microsoft.AspNet.Mvc.Infrastructure; using Microsoft.AspNet.Testing.xunit; using Newtonsoft.Json; @@ -13,9 +13,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class ConsumesAttributeTests : IClassFixture> + public class ConsumesAttributeTests : IClassFixture> { - public ConsumesAttributeTests(MvcTestFixture fixture) + public ConsumesAttributeTests(MvcTestFixture fixture) { Client = fixture.Client; } @@ -39,31 +39,6 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests Assert.Null(product); } - [Fact] - public async Task NoRequestContentType_Throws_IfMultipleActionsWithConstraints() - { - // Arrange - var request = new HttpRequestMessage( - HttpMethod.Post, - "http://localhost/ConsumesAttribute_AmbiguousActions/CreateProduct"); - - // Act - var response = await Client.SendAsync(request); - var exception = response.GetServerException(); - - // Assert - Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); - Assert.Equal(typeof(AmbiguousActionException).FullName, exception.ExceptionType); - // Mono issue - https://github.com/aspnet/External/issues/19 - Assert.Equal( - "Multiple actions matched. The following actions matched route data and had all constraints " + - "satisfied:" + PlatformNormalizer.GetNewLinesAsUnderscores(2) + "ActionConstraintsWebSite." + - "ConsumesAttribute_NoFallBackActionController." + - "CreateProduct" + PlatformNormalizer.GetNewLinesAsUnderscores(1) + "ActionConstraintsWebSite." + - "ConsumesAttribute_NoFallBackActionController.CreateProduct", - exception.ExceptionMessage); - } - [Fact] public async Task NoRequestContentType_Selects_IfASingleActionWithConstraintIsPresent() { @@ -131,7 +106,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests { // Arrange var input = "" + + "xmlns=\"http://schemas.datacontract.org/2004/07/BasicWebSite.Models\">" + "application/xml"; var request = new HttpRequestMessage( HttpMethod.Post, diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ContentNegotiationTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ContentNegotiationTest.cs index a2ba06ba4a..7e834e97f7 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ContentNegotiationTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/ContentNegotiationTest.cs @@ -13,9 +13,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class ContentNegotiationTest : IClassFixture> + public class ContentNegotiationTest : IClassFixture> { - public ContentNegotiationTest(MvcTestFixture fixture) + public ContentNegotiationTest(MvcTestFixture fixture) { Client = fixture.Client; } @@ -91,7 +91,9 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Arrange var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8"); var expectedOutput = "{\"Name\":\"John\",\"Address\":\"One Microsoft Way\"}"; - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Home/UserInfo_ProducesWithTypeOnly"); + var request = new HttpRequestMessage( + HttpMethod.Get, + "http://localhost/ContentNegotiation/UserInfo_ProducesWithTypeOnly"); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // Act @@ -112,11 +114,11 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Arrange var expectedContentType = MediaTypeHeaderValue.Parse("application/xml;charset=utf-8"); var expectedOutput = "" + - "
One Microsoft Way
John
"; + "xmlns=\"http://schemas.datacontract.org/2004/07/BasicWebSite.Models\">" + + "
One Microsoft Way
John"; var request = new HttpRequestMessage( HttpMethod.Get, - "http://localhost/Home/UserInfo_ProducesWithTypeAndContentType"); + "http://localhost/ContentNegotiation/UserInfo_ProducesWithTypeAndContentType"); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml")); // Act @@ -271,7 +273,8 @@ END:VCARD var expectedBody = "ProducesContentOnClassController"; // Act - var response = await Client.GetAsync("http://localhost/ProducesContentOnClass/ReturnClassNameContentTypeOnDerivedAction"); + var response = await Client.GetAsync( + "http://localhost/ProducesContentOnClass/ReturnClassNameContentTypeOnDerivedAction"); // Assert Assert.Equal(expectedContentType, response.Content.Headers.ContentType); @@ -287,7 +290,7 @@ END:VCARD var expectedBody = "{\"MethodName\":\"Produces_WithNonObjectResult\"}"; // Act - var response = await Client.GetAsync("http://localhost/JsonResult/Produces_WithNonObjectResult"); + var response = await Client.GetAsync("http://localhost/ProducesJson/Produces_WithNonObjectResult"); // Assert Assert.Equal(expectedContentType, response.Content.Headers.ContentType); @@ -303,12 +306,12 @@ END:VCARD // Arrange var expectedContentType = MediaTypeHeaderValue.Parse("application/xml;charset=utf-8"); var expectedBody = @"
" - + @"One Microsoft Way
John
"; + @"xmlns=""http://schemas.datacontract.org/2004/07/BasicWebSite.Models"">
" + + @"One Microsoft Way
John"; for (int i = 0; i < 5; i++) { - var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/Home/UserInfo"); + var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/ContentNegotiation/UserInfo"); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml")); request.Headers.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8")); diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs deleted file mode 100644 index 4f9747f4c7..0000000000 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs +++ /dev/null @@ -1,100 +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.Linq; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using Microsoft.AspNet.Cors.Infrastructure; -using Xunit; - -namespace Microsoft.AspNet.Mvc.FunctionalTests -{ - public class CorsMiddlewareTests : IClassFixture> - { - public CorsMiddlewareTests(MvcTestFixture fixture) - { - Client = fixture.Client; - } - - public HttpClient Client { get; } - - [Theory] - [InlineData("GET")] - [InlineData("HEAD")] - [InlineData("POST")] - public async Task ResourceWithSimpleRequestPolicy_Allows_SimpleRequests(string method) - { - // Arrange - var origin = "http://example.com"; - var request = new HttpRequestMessage( - new HttpMethod(method), - "http://localhost/CorsMiddleware/GetExclusiveContent"); - request.Headers.Add(CorsConstants.Origin, origin); - - // Act - var response = await Client.SendAsync(request); - - // Assert - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - var content = await response.Content.ReadAsStringAsync(); - Assert.Equal("exclusive", content); - var responseHeaders = response.Headers; - var header = Assert.Single(response.Headers); - Assert.Equal(CorsConstants.AccessControlAllowOrigin, header.Key); - Assert.Equal(new[] { "http://example.com" }, header.Value.ToArray()); - } - - [Theory] - [InlineData("GET")] - [InlineData("HEAD")] - [InlineData("POST")] - [InlineData("PUT")] - public async Task PolicyFailed_Disallows_PreFlightRequest(string method) - { - // Arrange - var request = new HttpRequestMessage( - new HttpMethod(CorsConstants.PreflightHttpMethod), - "http://localhost/CorsMiddleware/GetExclusiveContent"); - - // Adding a custom header makes it a non-simple request. - request.Headers.Add(CorsConstants.Origin, "http://example.com"); - request.Headers.Add(CorsConstants.AccessControlRequestMethod, method); - request.Headers.Add(CorsConstants.AccessControlRequestHeaders, "Custom"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - // Middleware applied the policy and since that did not pass, there were no access control headers. - Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); - Assert.Empty(response.Headers); - - // It should short circuit and hence no result. - var content = await response.Content.ReadAsStringAsync(); - Assert.Equal(string.Empty, content); - } - - [Fact] - public async Task PolicyFailed_Allows_ActualRequest_WithMissingResponseHeaders() - { - // Arrange - var request = new HttpRequestMessage(HttpMethod.Put, "http://localhost/CorsMiddleware/GetExclusiveContent"); - - // Adding a custom header makes it a non simple request. - request.Headers.Add(CorsConstants.Origin, "http://example2.com"); - - // Act - var response = await Client.SendAsync(request); - - // Assert - // Middleware applied the policy and since that did not pass, there were no access control headers. - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Empty(response.Headers); - - // It still has executed the action. - var content = await response.Content.ReadAsStringAsync(); - Assert.Equal("exclusive", content); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/OutputFormatterTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/OutputFormatterTest.cs index aa95bbe546..31e5605c04 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/OutputFormatterTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/OutputFormatterTest.cs @@ -9,9 +9,9 @@ using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class OutputFormatterTest : IClassFixture> + public class OutputFormatterTest : IClassFixture> { - public OutputFormatterTest(MvcTestFixture fixture) + public OutputFormatterTest(MvcTestFixture fixture) { Client = fixture.Client; } diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json index 11e23c75cc..2ed994214c 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json @@ -7,15 +7,10 @@ "warningsAsErrors": true }, "dependencies": { - "ActionConstraintsWebSite": "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", "ControllersFromServicesWebSite": "1.0.0", - "CorsMiddlewareWebSite": "1.0.0", "CorsWebSite": "1.0.0", "CustomRouteSample.Web": "1.0.0", "EmbeddedViewSample.Web": "1.0.0", diff --git a/test/WebSites/ActionConstraintsWebSite/ActionConstraintsWebSite.xproj b/test/WebSites/ActionConstraintsWebSite/ActionConstraintsWebSite.xproj deleted file mode 100644 index 65d6076b56..0000000000 --- a/test/WebSites/ActionConstraintsWebSite/ActionConstraintsWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - af210f69-9d31-43af-ac3a-cd366e252218 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 41642 - - - \ No newline at end of file diff --git a/test/WebSites/ActionConstraintsWebSite/Startup.cs b/test/WebSites/ActionConstraintsWebSite/Startup.cs deleted file mode 100644 index bc0ad38ae4..0000000000 --- a/test/WebSites/ActionConstraintsWebSite/Startup.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 Microsoft.AspNet.Builder; -using Microsoft.AspNet.Mvc; -using Microsoft.Extensions.DependencyInjection; - -namespace ActionConstraintsWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services - .AddMvc() - .AddXmlDataContractSerializerFormatters(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseErrorReporter(); - - app.UseMvc(routes => - { - routes.MapRoute( - name: "default", - template: "{controller}/{action}/{id?}"); - }); - } - } -} \ No newline at end of file diff --git a/test/WebSites/ActionConstraintsWebSite/project.json b/test/WebSites/ActionConstraintsWebSite/project.json deleted file mode 100644 index 47c7af0a17..0000000000 --- a/test/WebSites/ActionConstraintsWebSite/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/ActionConstraintsWebSite/readme.md b/test/WebSites/ActionConstraintsWebSite/readme.md deleted file mode 100644 index 0c10ec105e..0000000000 --- a/test/WebSites/ActionConstraintsWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -ActionConstraintWebSite -=== - -This web site illustrates how to use action constraints to select the right action based on the request. diff --git a/test/WebSites/ActionConstraintsWebSite/wwwroot/HelloWorld.htm b/test/WebSites/ActionConstraintsWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e9..0000000000 --- a/test/WebSites/ActionConstraintsWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/AntiforgeryTokenWebSite/AntiforgeryTokenWebSite.xproj b/test/WebSites/AntiforgeryTokenWebSite/AntiforgeryTokenWebSite.xproj deleted file mode 100644 index f4778bec48..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/AntiforgeryTokenWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - a353b17e-a940-4ce8-8bf9-179e24a9041f - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 49637 - - - \ No newline at end of file diff --git a/test/WebSites/AntiforgeryTokenWebSite/Controllers/HomeController.cs b/test/WebSites/AntiforgeryTokenWebSite/Controllers/HomeController.cs deleted file mode 100644 index 0aebd9f32c..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/Controllers/HomeController.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 AntiforgeryTokenWebSite -{ - // This controller is reachable via traditional routing. - public class HomeController : Controller - { - public IActionResult Index() - { - return View("MyView"); - } - } -} \ No newline at end of file diff --git a/test/WebSites/AntiforgeryTokenWebSite/Startup.cs b/test/WebSites/AntiforgeryTokenWebSite/Startup.cs deleted file mode 100644 index 84f947c979..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/Startup.cs +++ /dev/null @@ -1,30 +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 AntiforgeryTokenWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseErrorReporter(); - - app.UseMvc(routes => - { - routes.MapRoute("ActionAsMethod", "{controller}/{action}", - defaults: new { controller = "Home", action = "Index" }); - }); - } - } -} diff --git a/test/WebSites/AntiforgeryTokenWebSite/Views/Home/MyView.cshtml b/test/WebSites/AntiforgeryTokenWebSite/Views/Home/MyView.cshtml deleted file mode 100644 index a2c25ed46b..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/Views/Home/MyView.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ Layout = "/Views/Shared/_Layout.cshtml"; - ViewBag.Title = "Home Page"; -} diff --git a/test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_LoginPartial.cshtml b/test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_LoginPartial.cshtml deleted file mode 100644 index ce6e407537..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_LoginPartial.cshtml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/test/WebSites/AntiforgeryTokenWebSite/project.json b/test/WebSites/AntiforgeryTokenWebSite/project.json deleted file mode 100644 index 14c1cb9408..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/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/AntiforgeryTokenWebSite/readme.md b/test/WebSites/AntiforgeryTokenWebSite/readme.md deleted file mode 100644 index 24b7900648..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/readme.md +++ /dev/null @@ -1,5 +0,0 @@ -AntiforgeryTokenWebSite -=== - -This web site illustrates how to use the antiforgery system to prevent CSRF attacks. The web site has an -`AccountsController` which uses an antiforgery token to validate incoming form posts. diff --git a/test/WebSites/AntiforgeryTokenWebSite/wwwroot/HelloWorld.htm b/test/WebSites/AntiforgeryTokenWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e9..0000000000 --- a/test/WebSites/AntiforgeryTokenWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_NoFallBackActionController.cs b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_NoFallBackActionController.cs similarity index 89% rename from test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_NoFallBackActionController.cs rename to test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_NoFallBackActionController.cs index e6dbe02d93..c0dfd7b7eb 100644 --- a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_NoFallBackActionController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_NoFallBackActionController.cs @@ -1,9 +1,10 @@ // 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 BasicWebSite.Models; using Microsoft.AspNet.Mvc; -namespace ActionConstraintsWebSite +namespace BasicWebSite.Controllers.ActionConstraints { [Route("ConsumesAttribute_AmbiguousActions/[action]")] public class ConsumesAttribute_NoFallBackActionController : Controller diff --git a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_OveridesBaseController.cs b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_OveridesBaseController.cs similarity index 92% rename from test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_OveridesBaseController.cs rename to test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_OveridesBaseController.cs index ca5889925b..8462f9fc08 100644 --- a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_OveridesBaseController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_OveridesBaseController.cs @@ -1,9 +1,10 @@ // 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 BasicWebSite.Models; using Microsoft.AspNet.Mvc; -namespace ActionConstraintsWebSite +namespace BasicWebSite.Controllers.ActionConstraints { [Consumes("application/json")] public class ConsumesAttribute_OverridesBaseController : Controller diff --git a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_OveridesController.cs b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_OveridesController.cs similarity index 88% rename from test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_OveridesController.cs rename to test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_OveridesController.cs index ca06eca38f..e95862c33a 100644 --- a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_OveridesController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_OveridesController.cs @@ -1,9 +1,10 @@ // 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 BasicWebSite.Models; using Microsoft.AspNet.Mvc; -namespace ActionConstraintsWebSite +namespace BasicWebSite.Controllers.ActionConstraints { [Consumes("application/xml")] public class ConsumesAttribute_OverridesController : ConsumesAttribute_OverridesBaseController diff --git a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_PassThroughController.cs b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_PassThroughController.cs similarity index 85% rename from test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_PassThroughController.cs rename to test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_PassThroughController.cs index 9b77bceb3b..5d5b904250 100644 --- a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_PassThroughController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_PassThroughController.cs @@ -1,10 +1,10 @@ // 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 BasicWebSite.Models; using Microsoft.AspNet.Mvc; -namespace ActionConstraintsWebSite +namespace BasicWebSite.Controllers.ActionConstraints { [Route("ConsumesAttribute_PassThrough/[action]")] public class ConsumesAttribute_PassThroughController : Controller diff --git a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_WithFallbackActionController.cs b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_WithFallbackActionController.cs similarity index 90% rename from test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_WithFallbackActionController.cs rename to test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_WithFallbackActionController.cs index 35eca58e16..2c7ac28e3d 100644 --- a/test/WebSites/ActionConstraintsWebSite/Controllers/ConsumesAttribute_WithFallbackActionController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ActionConstraints/ConsumesAttribute_WithFallbackActionController.cs @@ -1,10 +1,10 @@ // 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 BasicWebSite.Models; using Microsoft.AspNet.Mvc; -namespace ActionConstraintsWebSite +namespace BasicWebSite.Controllers.ActionConstraints { [Route("ConsumesAttribute_Company/[action]")] public class ConsumesAttribute_WithFallbackActionController : Controller diff --git a/test/WebSites/AntiforgeryTokenWebSite/Controllers/AccountController.cs b/test/WebSites/BasicWebSite/Controllers/AntiforgeryController.cs similarity index 70% rename from test/WebSites/AntiforgeryTokenWebSite/Controllers/AccountController.cs rename to test/WebSites/BasicWebSite/Controllers/AntiforgeryController.cs index 6a2e775a94..f522a3a766 100644 --- a/test/WebSites/AntiforgeryTokenWebSite/Controllers/AccountController.cs +++ b/test/WebSites/BasicWebSite/Controllers/AntiforgeryController.cs @@ -1,19 +1,25 @@ // 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 BasicWebSite.Models; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Mvc; -namespace AntiforgeryTokenWebSite +namespace BasicWebSite.Controllers { // This controller is reachable via traditional routing. - public class AccountController : Controller + public class AntiforgeryController : Controller { - // GET: /Account/Login + public IActionResult Index() + { + return View(); + } + + // GET: /Antiforgery/Login [AllowAnonymous] public ActionResult Login(string returnUrl = null) { - ViewBag.ReturnUrl = returnUrl; + ViewData["ReturnUrl"] = returnUrl; return View(); } @@ -24,7 +30,7 @@ namespace AntiforgeryTokenWebSite return "somestring"; } - // POST: /Account/Login + // POST: /Antiforgery/Login [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] @@ -33,16 +39,16 @@ namespace AntiforgeryTokenWebSite return "OK"; } - // GET: /Account/FlushAsyncLogin + // GET: /Antiforgery/FlushAsyncLogin [AllowAnonymous] public ActionResult FlushAsyncLogin(string returnUrl = null) { - ViewBag.ReturnUrl = returnUrl; + ViewData["ReturnUrl"] = returnUrl; return View(); } - // POST: /Account/FlushAsyncLogin + // POST: /Antiforgery/FlushAsyncLogin [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/HomeController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ContentNegotiationController.cs similarity index 86% rename from test/WebSites/ContentNegotiationWebSite/Controllers/HomeController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ContentNegotiationController.cs index 86b48894d3..b09a78adc6 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/HomeController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ContentNegotiationController.cs @@ -1,11 +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. +using BasicWebSite.Models; using Microsoft.AspNet.Mvc; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { - public class HomeController : Controller + public class ContentNegotiationController : Controller { public IActionResult Index() { diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/FallbackOnTypeBasedMatchController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/FallbackOnTypeBasedMatchController.cs similarity index 95% rename from test/WebSites/ContentNegotiationWebSite/Controllers/FallbackOnTypeBasedMatchController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/FallbackOnTypeBasedMatchController.cs index ac193b4e71..1f1f096e7a 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/FallbackOnTypeBasedMatchController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/FallbackOnTypeBasedMatchController.cs @@ -1,12 +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 BasicWebSite.Formatters; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Formatters; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.OptionsModel; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { public class FallbackOnTypeBasedMatchController : Controller { @@ -64,7 +65,7 @@ namespace ContentNegotiationWebSite } public IActionResult ReturnString( - bool matchFormatterOnObjectType, + bool matchFormatterOnObjectType, [FromServices] IOptions optionsAccessor) { var objectResult = new ObjectResult("Hello World!"); diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/FormatFilterController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/FormatFilterController.cs similarity index 90% rename from test/WebSites/ContentNegotiationWebSite/Controllers/FormatFilterController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/FormatFilterController.cs index 31feab230d..1b33da9c7b 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/FormatFilterController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/FormatFilterController.cs @@ -1,10 +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 BasicWebSite.Formatters; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { [Produces("application/FormatFilterController")] public class FormatFilterController : Controller diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/NoContentController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoContentController.cs similarity index 94% rename from test/WebSites/ContentNegotiationWebSite/Controllers/NoContentController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoContentController.cs index 9ce3ef190d..a010b6d027 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/NoContentController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoContentController.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Mvc; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { public class NoContentController : Controller { diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/NoContentDoNotTreatNullValueAsNoContentController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoContentDoNotTreatNullValueAsNoContentController.cs similarity index 95% rename from test/WebSites/ContentNegotiationWebSite/Controllers/NoContentDoNotTreatNullValueAsNoContentController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoContentDoNotTreatNullValueAsNoContentController.cs index c89a9cd40c..7216de3843 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/NoContentDoNotTreatNullValueAsNoContentController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoContentDoNotTreatNullValueAsNoContentController.cs @@ -6,7 +6,7 @@ using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.Formatters; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { public class NoContentDoNotTreatNullValueAsNoContentController : Controller { diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/NoProducesContentOnClassController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoProducesContentOnClassController.cs similarity index 92% rename from test/WebSites/ContentNegotiationWebSite/Controllers/NoProducesContentOnClassController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoProducesContentOnClassController.cs index 954fd59924..e815167277 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/NoProducesContentOnClassController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NoProducesContentOnClassController.cs @@ -1,10 +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 BasicWebSite.Formatters; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { public class NoProducesContentOnClassController : ProducesContentBaseController { diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/NormalController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NormalController.cs similarity index 94% rename from test/WebSites/ContentNegotiationWebSite/Controllers/NormalController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NormalController.cs index d274cd5383..20ba77d5bc 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/NormalController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/NormalController.cs @@ -1,12 +1,14 @@ // 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 BasicWebSite.Formatters; +using BasicWebSite.Models; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.Formatters; using Newtonsoft.Json; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { public class NormalController : Controller { diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/ProducesContentBaseController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesContentBaseController.cs similarity index 94% rename from test/WebSites/ContentNegotiationWebSite/Controllers/ProducesContentBaseController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesContentBaseController.cs index 1c88f279ad..aa002944f5 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/ProducesContentBaseController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesContentBaseController.cs @@ -1,10 +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 BasicWebSite.Formatters; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { [Produces("application/custom_ProducesContentBaseController")] public class ProducesContentBaseController : Controller diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/ProducesContentOnClassController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesContentOnClassController.cs similarity index 95% rename from test/WebSites/ContentNegotiationWebSite/Controllers/ProducesContentOnClassController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesContentOnClassController.cs index b73b761dd6..0a8c623c02 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/ProducesContentOnClassController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesContentOnClassController.cs @@ -1,10 +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 BasicWebSite.Formatters; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { [Produces("application/custom_ProducesContentOnClassController")] public class ProducesContentOnClassController : ProducesContentBaseController diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/JsonResultController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesJsonController.cs similarity index 79% rename from test/WebSites/ContentNegotiationWebSite/Controllers/JsonResultController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesJsonController.cs index b26eedfeda..36d6373c72 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/JsonResultController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesJsonController.cs @@ -3,9 +3,9 @@ using Microsoft.AspNet.Mvc; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { - public class JsonResultController : Controller + public class ProducesJsonController : Controller { [Produces("application/xml")] public IActionResult Produces_WithNonObjectResult() diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/ProducesWithMediaTypeParametersController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesWithMediaTypeParametersController.cs similarity index 91% rename from test/WebSites/ContentNegotiationWebSite/Controllers/ProducesWithMediaTypeParametersController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesWithMediaTypeParametersController.cs index b55e68a1a7..79029d5806 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/ProducesWithMediaTypeParametersController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/ProducesWithMediaTypeParametersController.cs @@ -1,11 +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. -using ContentNegotiationWebSite.Models; +using BasicWebSite.Formatters; +using BasicWebSite.Models; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { public class ProducesWithMediaTypeParametersController : Controller { diff --git a/test/WebSites/ContentNegotiationWebSite/Controllers/TextPlainController.cs b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/TextPlainController.cs similarity index 95% rename from test/WebSites/ContentNegotiationWebSite/Controllers/TextPlainController.cs rename to test/WebSites/BasicWebSite/Controllers/ContentNegotiation/TextPlainController.cs index d3dd0c32ac..27f0d8fda6 100644 --- a/test/WebSites/ContentNegotiationWebSite/Controllers/TextPlainController.cs +++ b/test/WebSites/BasicWebSite/Controllers/ContentNegotiation/TextPlainController.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Mvc; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Controllers.ContentNegotiation { public class TextPlainController : Controller { diff --git a/test/WebSites/ContentNegotiationWebSite/CustomFormatter.cs b/test/WebSites/BasicWebSite/Formatters/CustomFormatter.cs similarity index 97% rename from test/WebSites/ContentNegotiationWebSite/CustomFormatter.cs rename to test/WebSites/BasicWebSite/Formatters/CustomFormatter.cs index 9ad316d094..7d089b3099 100644 --- a/test/WebSites/ContentNegotiationWebSite/CustomFormatter.cs +++ b/test/WebSites/BasicWebSite/Formatters/CustomFormatter.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc.Formatters; using Microsoft.Net.Http.Headers; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Formatters { public class CustomFormatter : OutputFormatter { diff --git a/test/WebSites/ContentNegotiationWebSite/PlainTextFormatter.cs b/test/WebSites/BasicWebSite/Formatters/PlainTextFormatter.cs similarity index 97% rename from test/WebSites/ContentNegotiationWebSite/PlainTextFormatter.cs rename to test/WebSites/BasicWebSite/Formatters/PlainTextFormatter.cs index b8e328de7e..83cfc30f5a 100644 --- a/test/WebSites/ContentNegotiationWebSite/PlainTextFormatter.cs +++ b/test/WebSites/BasicWebSite/Formatters/PlainTextFormatter.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc.Formatters; using Microsoft.Net.Http.Headers; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Formatters { public class PlainTextFormatter : OutputFormatter { diff --git a/test/WebSites/ContentNegotiationWebSite/VCardFormatter_V3.cs b/test/WebSites/BasicWebSite/Formatters/VCardFormatter_V3.cs similarity index 94% rename from test/WebSites/ContentNegotiationWebSite/VCardFormatter_V3.cs rename to test/WebSites/BasicWebSite/Formatters/VCardFormatter_V3.cs index 3f5d30ac88..326d32d064 100644 --- a/test/WebSites/ContentNegotiationWebSite/VCardFormatter_V3.cs +++ b/test/WebSites/BasicWebSite/Formatters/VCardFormatter_V3.cs @@ -5,12 +5,12 @@ using System; using System.Reflection; using System.Text; using System.Threading.Tasks; -using ContentNegotiationWebSite.Models; +using BasicWebSite.Models; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc.Formatters; using Microsoft.Net.Http.Headers; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Formatters { /// /// Provides contact information of a person through VCard format. diff --git a/test/WebSites/ContentNegotiationWebSite/VCardFormatter_V4.cs b/test/WebSites/BasicWebSite/Formatters/VCardFormatter_V4.cs similarity index 95% rename from test/WebSites/ContentNegotiationWebSite/VCardFormatter_V4.cs rename to test/WebSites/BasicWebSite/Formatters/VCardFormatter_V4.cs index bf7392bb51..ffcc5e2913 100644 --- a/test/WebSites/ContentNegotiationWebSite/VCardFormatter_V4.cs +++ b/test/WebSites/BasicWebSite/Formatters/VCardFormatter_V4.cs @@ -5,12 +5,12 @@ using System; using System.Reflection; using System.Text; using System.Threading.Tasks; -using ContentNegotiationWebSite.Models; +using BasicWebSite.Models; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc.Formatters; using Microsoft.Net.Http.Headers; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Formatters { /// /// Provides contact information of a person through VCard format. diff --git a/test/WebSites/ContentNegotiationWebSite/Models/Contact.cs b/test/WebSites/BasicWebSite/Models/Contact.cs similarity index 85% rename from test/WebSites/ContentNegotiationWebSite/Models/Contact.cs rename to test/WebSites/BasicWebSite/Models/Contact.cs index a531ac2003..3c4190a807 100644 --- a/test/WebSites/ContentNegotiationWebSite/Models/Contact.cs +++ b/test/WebSites/BasicWebSite/Models/Contact.cs @@ -1,7 +1,7 @@ // 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 ContentNegotiationWebSite.Models +namespace BasicWebSite.Models { public class Contact { @@ -25,10 +25,4 @@ namespace ContentNegotiationWebSite.Models public string Self { get; set; } } - - public enum GenderType - { - Male, - Female - } } \ No newline at end of file diff --git a/test/WebSites/BasicWebSite/Models/GenderType.cs b/test/WebSites/BasicWebSite/Models/GenderType.cs new file mode 100644 index 0000000000..850c5477c7 --- /dev/null +++ b/test/WebSites/BasicWebSite/Models/GenderType.cs @@ -0,0 +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. + +namespace BasicWebSite.Models +{ + public enum GenderType + { + Male, + Female, + } +} diff --git a/test/WebSites/AntiforgeryTokenWebSite/Models/LoginViewModels.cs b/test/WebSites/BasicWebSite/Models/LoginViewModel.cs similarity index 94% rename from test/WebSites/AntiforgeryTokenWebSite/Models/LoginViewModels.cs rename to test/WebSites/BasicWebSite/Models/LoginViewModel.cs index 442568d8fb..6e524a3b70 100644 --- a/test/WebSites/AntiforgeryTokenWebSite/Models/LoginViewModels.cs +++ b/test/WebSites/BasicWebSite/Models/LoginViewModel.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; -namespace AntiforgeryTokenWebSite +namespace BasicWebSite.Models { public class LoginViewModel { diff --git a/test/WebSites/ActionConstraintsWebSite/Models/Product.cs b/test/WebSites/BasicWebSite/Models/Product.cs similarity index 91% rename from test/WebSites/ActionConstraintsWebSite/Models/Product.cs rename to test/WebSites/BasicWebSite/Models/Product.cs index 701ee50377..f3bffd90cd 100644 --- a/test/WebSites/ActionConstraintsWebSite/Models/Product.cs +++ b/test/WebSites/BasicWebSite/Models/Product.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; -namespace ActionConstraintsWebSite +namespace BasicWebSite.Models { public class Product { diff --git a/test/WebSites/ActionConstraintsWebSite/Models/Product_Json.cs b/test/WebSites/BasicWebSite/Models/Product_Json.cs similarity index 86% rename from test/WebSites/ActionConstraintsWebSite/Models/Product_Json.cs rename to test/WebSites/BasicWebSite/Models/Product_Json.cs index c4276849bd..c7c15d5af0 100644 --- a/test/WebSites/ActionConstraintsWebSite/Models/Product_Json.cs +++ b/test/WebSites/BasicWebSite/Models/Product_Json.cs @@ -1,7 +1,7 @@ // 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 ActionConstraintsWebSite +namespace BasicWebSite.Models { public class Product_Json : Product { diff --git a/test/WebSites/ActionConstraintsWebSite/Models/Product_Xml.cs b/test/WebSites/BasicWebSite/Models/Product_Xml.cs similarity index 85% rename from test/WebSites/ActionConstraintsWebSite/Models/Product_Xml.cs rename to test/WebSites/BasicWebSite/Models/Product_Xml.cs index 2ad2e913e6..09e216e4ad 100644 --- a/test/WebSites/ActionConstraintsWebSite/Models/Product_Xml.cs +++ b/test/WebSites/BasicWebSite/Models/Product_Xml.cs @@ -1,7 +1,7 @@ // 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 ActionConstraintsWebSite +namespace BasicWebSite.Models { public class Product_Xml : Product { diff --git a/test/WebSites/ActionConstraintsWebSite/Models/Product_text.cs b/test/WebSites/BasicWebSite/Models/Product_text.cs similarity index 86% rename from test/WebSites/ActionConstraintsWebSite/Models/Product_text.cs rename to test/WebSites/BasicWebSite/Models/Product_text.cs index 55f036bf0e..dc78b3edd2 100644 --- a/test/WebSites/ActionConstraintsWebSite/Models/Product_text.cs +++ b/test/WebSites/BasicWebSite/Models/Product_text.cs @@ -1,7 +1,7 @@ // 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 ActionConstraintsWebSite +namespace BasicWebSite.Models { public class Product_Text : Product { diff --git a/test/WebSites/ContentNegotiationWebSite/Models/User.cs b/test/WebSites/BasicWebSite/Models/User.cs similarity index 91% rename from test/WebSites/ContentNegotiationWebSite/Models/User.cs rename to test/WebSites/BasicWebSite/Models/User.cs index 067a46281d..7c2b6655cb 100644 --- a/test/WebSites/ContentNegotiationWebSite/Models/User.cs +++ b/test/WebSites/BasicWebSite/Models/User.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; -namespace ContentNegotiationWebSite +namespace BasicWebSite.Models { [DisplayColumn("Name")] public class User diff --git a/test/WebSites/BasicWebSite/Startup.cs b/test/WebSites/BasicWebSite/Startup.cs index 3859a24fad..2da8152c34 100644 --- a/test/WebSites/BasicWebSite/Startup.cs +++ b/test/WebSites/BasicWebSite/Startup.cs @@ -14,10 +14,11 @@ namespace BasicWebSite // Set up application services public void ConfigureServices(IServiceCollection services) { - services.AddMvc(options => - { - options.Conventions.Add(new ApplicationDescription("This is a basic website.")); - }); + services + .AddMvc( + options => { options.Conventions.Add(new ApplicationDescription("This is a basic website.")); }) + .AddXmlDataContractSerializerFormatters(); + services.AddLogging(); services.AddSingleton(); services.AddSingleton(); diff --git a/test/WebSites/AntiforgeryTokenWebSite/Views/Account/FlushAsyncLogin.cshtml b/test/WebSites/BasicWebSite/Views/Antiforgery/FlushAsyncLogin.cshtml similarity index 82% rename from test/WebSites/AntiforgeryTokenWebSite/Views/Account/FlushAsyncLogin.cshtml rename to test/WebSites/BasicWebSite/Views/Antiforgery/FlushAsyncLogin.cshtml index aa92c14783..b429578f5d 100644 --- a/test/WebSites/AntiforgeryTokenWebSite/Views/Account/FlushAsyncLogin.cshtml +++ b/test/WebSites/BasicWebSite/Views/Antiforgery/FlushAsyncLogin.cshtml @@ -1,17 +1,17 @@ -@model AntiforgeryTokenWebSite.LoginViewModel +@model BasicWebSite.Models.LoginViewModel @{ - ViewBag.Title = "Log in"; - Layout = "/Views/Shared/_FlushAsyncLayout.cshtml"; + Layout = "_FlushAsyncLayout.cshtml"; + ViewData["Title"] = "Log in"; } @section Login { -

@ViewBag.Title.

+

@ViewData["Title"].

- @using (Html.BeginForm("FlushAsyncLogin", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) + @using (Html.BeginForm("FlushAsyncLogin", "Antiforgery", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken()

Use a local account to log in.

diff --git a/test/WebSites/BasicWebSite/Views/Antiforgery/Index.cshtml b/test/WebSites/BasicWebSite/Views/Antiforgery/Index.cshtml new file mode 100644 index 0000000000..6602e7693f --- /dev/null +++ b/test/WebSites/BasicWebSite/Views/Antiforgery/Index.cshtml @@ -0,0 +1,4 @@ +@{ + Layout = "_Layout.cshtml"; + ViewData["Title"] = "Home Page"; +} diff --git a/test/WebSites/AntiforgeryTokenWebSite/Views/Account/Login.cshtml b/test/WebSites/BasicWebSite/Views/Antiforgery/Login.cshtml similarity index 85% rename from test/WebSites/AntiforgeryTokenWebSite/Views/Account/Login.cshtml rename to test/WebSites/BasicWebSite/Views/Antiforgery/Login.cshtml index 6d449c7c49..0bda046f1e 100644 --- a/test/WebSites/AntiforgeryTokenWebSite/Views/Account/Login.cshtml +++ b/test/WebSites/BasicWebSite/Views/Antiforgery/Login.cshtml @@ -1,14 +1,14 @@ -@model AntiforgeryTokenWebSite.LoginViewModel +@model BasicWebSite.Models.LoginViewModel @{ - ViewBag.Title = "Log in"; + ViewData["Title"] = "Log in"; } -

@ViewBag.Title.

+

@ViewData["Title"].

- @using (Html.BeginForm("Login", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) + @using (Html.BeginForm("Login", "Antiforgery", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken()

Use a local account to log in.

@@ -37,7 +37,7 @@
-@using (Html.BeginForm("UseFacebookLogin", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) +@using (Html.BeginForm("UseFacebookLogin", "Antiforgery", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken()

Use Facebook login.

diff --git a/test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_FlushAsyncLayout.cshtml b/test/WebSites/BasicWebSite/Views/Antiforgery/_FlushAsyncLayout.cshtml similarity index 54% rename from test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_FlushAsyncLayout.cshtml rename to test/WebSites/BasicWebSite/Views/Antiforgery/_FlushAsyncLayout.cshtml index 838fd4996b..6cd0528e8b 100644 --- a/test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_FlushAsyncLayout.cshtml +++ b/test/WebSites/BasicWebSite/Views/Antiforgery/_FlushAsyncLayout.cshtml @@ -1,12 +1,12 @@  - @ViewBag.Title – Antiforgery Functional Tests + @ViewData["Title"] – Antiforgery Functional Tests @SetAntiforgeryCookieAndHeader() @await FlushAsync() - @Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) + @Html.ActionLink("Log in", "Login", "Antiforgery", routeValues: null, htmlAttributes: new { id = "loginLink" })
@RenderBody() @await RenderSectionAsync("Login", required: false) diff --git a/test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_Layout.cshtml b/test/WebSites/BasicWebSite/Views/Antiforgery/_Layout.cshtml similarity index 83% rename from test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_Layout.cshtml rename to test/WebSites/BasicWebSite/Views/Antiforgery/_Layout.cshtml index a37fecfbab..84480566f3 100644 --- a/test/WebSites/AntiforgeryTokenWebSite/Views/Shared/_Layout.cshtml +++ b/test/WebSites/BasicWebSite/Views/Antiforgery/_Layout.cshtml @@ -3,7 +3,7 @@ - @ViewBag.Title –Antiforgery Functional Tests + @ViewData["Title"] –Antiforgery Functional Tests
diff --git a/test/WebSites/BasicWebSite/Views/Antiforgery/_LoginPartial.cshtml b/test/WebSites/BasicWebSite/Views/Antiforgery/_LoginPartial.cshtml new file mode 100644 index 0000000000..c7933703c7 --- /dev/null +++ b/test/WebSites/BasicWebSite/Views/Antiforgery/_LoginPartial.cshtml @@ -0,0 +1,3 @@ + diff --git a/test/WebSites/BasicWebSite/project.json b/test/WebSites/BasicWebSite/project.json index 33b64f4936..ed9fb45491 100644 --- a/test/WebSites/BasicWebSite/project.json +++ b/test/WebSites/BasicWebSite/project.json @@ -3,14 +3,15 @@ "weblistener": "Microsoft.AspNet.Server.WebListener", "web": "Microsoft.AspNet.Server.Kestrel" }, - "dependencies": { - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.Session": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*" - }, + "dependencies": { + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*", + "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*", + "Microsoft.AspNet.Session": "1.0.0-*", + "Microsoft.AspNet.StaticFiles": "1.0.0-*" + }, "frameworks": { "dnx451": { }, "dnxcore50": { } diff --git a/test/WebSites/BasicWebSite/wwwroot/HelloWorld.htm b/test/WebSites/BasicWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e9..0000000000 --- a/test/WebSites/BasicWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/CompositeViewEngineWebSite/CompositeViewEngineWebSite.xproj b/test/WebSites/CompositeViewEngineWebSite/CompositeViewEngineWebSite.xproj deleted file mode 100644 index 46c04e7d3f..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/CompositeViewEngineWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - a853b2ba-4449-4908-a416-5a3c027fc22b - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 8643 - - - \ No newline at end of file diff --git a/test/WebSites/CompositeViewEngineWebSite/HomeController.cs b/test/WebSites/CompositeViewEngineWebSite/HomeController.cs deleted file mode 100644 index 1928e772e9..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/HomeController.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 Microsoft.AspNet.Mvc; - -namespace CompositeViewEngineWebSite -{ - public class HomeController : Controller - { - public ViewResult Index() - { - return View(); - } - - public ViewResult TestView() - { - return View("test-view"); - } - } -} \ No newline at end of file diff --git a/test/WebSites/CompositeViewEngineWebSite/Startup.cs b/test/WebSites/CompositeViewEngineWebSite/Startup.cs deleted file mode 100644 index 41ffe5e292..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/Startup.cs +++ /dev/null @@ -1,31 +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 CompositeViewEngineWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - // Add a view engine as the first one in the list. - services - .AddMvc() - .AddViewOptions(options => - { - options.ViewEngines.Insert(0, new TestViewEngine()); - }); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - // Add MVC to the request pipeline - app.UseMvcWithDefaultRoute(); - } - } -} diff --git a/test/WebSites/CompositeViewEngineWebSite/TestPartialView.cs b/test/WebSites/CompositeViewEngineWebSite/TestPartialView.cs deleted file mode 100644 index 42f221ac96..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/TestPartialView.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.Threading.Tasks; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewEngines; - -namespace CompositeViewEngineWebSite -{ - public class TestPartialView : IView - { - public string Path { get; set; } - - public async Task RenderAsync(ViewContext context) - { - await context.Writer.WriteLineAsync("world"); - } - } -} \ No newline at end of file diff --git a/test/WebSites/CompositeViewEngineWebSite/TestView.cs b/test/WebSites/CompositeViewEngineWebSite/TestView.cs deleted file mode 100644 index ef6fc50bc6..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/TestView.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.Threading.Tasks; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Mvc.ViewEngines; - -namespace CompositeViewEngineWebSite -{ - public class TestView : IView - { - public string Path { get; set; } - - public async Task RenderAsync(ViewContext context) - { - await context.Writer.WriteLineAsync("Content from test view"); - } - } -} \ No newline at end of file diff --git a/test/WebSites/CompositeViewEngineWebSite/TestViewEngine.cs b/test/WebSites/CompositeViewEngineWebSite/TestViewEngine.cs deleted file mode 100644 index c9bb0a3a9e..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/TestViewEngine.cs +++ /dev/null @@ -1,31 +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 Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ViewEngines; - -namespace CompositeViewEngineWebSite -{ - public class TestViewEngine : IViewEngine - { - public ViewEngineResult FindView(ActionContext context, string viewName, bool isMainPage) - { - if (string.Equals(viewName, "partial-test-view", StringComparison.Ordinal) || - string.Equals(viewName, "test-view", StringComparison.Ordinal)) - { - var view = isMainPage ? (IView)new TestView() : new TestPartialView(); - - return ViewEngineResult.Found(viewName, view); - } - - return ViewEngineResult.NotFound(viewName, Enumerable.Empty()); - } - - public ViewEngineResult GetView(string executingFilePath, string viewPath, bool isMainPage) - { - return ViewEngineResult.NotFound(viewPath, Enumerable.Empty()); - } - } -} \ No newline at end of file diff --git a/test/WebSites/CompositeViewEngineWebSite/Views/Home/Index.cshtml b/test/WebSites/CompositeViewEngineWebSite/Views/Home/Index.cshtml deleted file mode 100644 index 7b7a2e971d..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/Views/Home/Index.cshtml +++ /dev/null @@ -1 +0,0 @@ -Hello @await Html.PartialAsync("partial-test-view") \ No newline at end of file diff --git a/test/WebSites/CompositeViewEngineWebSite/project.json b/test/WebSites/CompositeViewEngineWebSite/project.json deleted file mode 100644 index 14c1cb9408..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/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/CompositeViewEngineWebSite/readme.md b/test/WebSites/CompositeViewEngineWebSite/readme.md deleted file mode 100644 index 745ee48870..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -CompositeViewEngineWebSite -=== - -This web site illustrates how to register and use custom `ViewEngines`. diff --git a/test/WebSites/CompositeViewEngineWebSite/wwwroot/HelloWorld.htm b/test/WebSites/CompositeViewEngineWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e9..0000000000 --- a/test/WebSites/CompositeViewEngineWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/ContentNegotiationWebSite/ContentNegotiationWebSite.xproj b/test/WebSites/ContentNegotiationWebSite/ContentNegotiationWebSite.xproj deleted file mode 100644 index 8d8974ca3e..0000000000 --- a/test/WebSites/ContentNegotiationWebSite/ContentNegotiationWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - c6e5affa-890a-448f-8de3-878b1d3c9fc7 - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 49636 - - - \ No newline at end of file diff --git a/test/WebSites/ContentNegotiationWebSite/Startup.cs b/test/WebSites/ContentNegotiationWebSite/Startup.cs deleted file mode 100644 index 2060c3b0d1..0000000000 --- a/test/WebSites/ContentNegotiationWebSite/Startup.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 Microsoft.AspNet.Builder; -using Microsoft.AspNet.Mvc; -using Microsoft.Extensions.DependencyInjection; - -namespace ContentNegotiationWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc().AddXmlDataContractSerializerFormatters(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - 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/ContentNegotiationWebSite/project.json b/test/WebSites/ContentNegotiationWebSite/project.json deleted file mode 100644 index 47c7af0a17..0000000000 --- a/test/WebSites/ContentNegotiationWebSite/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/ContentNegotiationWebSite/readme.md b/test/WebSites/ContentNegotiationWebSite/readme.md deleted file mode 100644 index ded583ecff..0000000000 --- a/test/WebSites/ContentNegotiationWebSite/readme.md +++ /dev/null @@ -1,5 +0,0 @@ -ContentNegotiationWebSite -=== - -This web site illustrates in depth how MVC performs output content negotiation based on the input headers and -content. It also demonstrates various options available to participate in content negotiation process. diff --git a/test/WebSites/ContentNegotiationWebSite/wwwroot/HelloWorld.htm b/test/WebSites/ContentNegotiationWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e9..0000000000 --- a/test/WebSites/ContentNegotiationWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/CorsMiddlewareWebSite/Controllers/BlogController.cs b/test/WebSites/CorsMiddlewareWebSite/Controllers/BlogController.cs deleted file mode 100644 index 17dc5465c0..0000000000 --- a/test/WebSites/CorsMiddlewareWebSite/Controllers/BlogController.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 CorsMiddlewareWebSite -{ - [Route("CorsMiddleWare/[action]")] - public class BlogController : Controller - { - public string GetExclusiveContent() - { - return "exclusive"; - } - } -} \ No newline at end of file diff --git a/test/WebSites/CorsMiddlewareWebSite/CorsMiddlewareWebSite.xproj b/test/WebSites/CorsMiddlewareWebSite/CorsMiddlewareWebSite.xproj deleted file mode 100644 index 7e7d95f9c7..0000000000 --- a/test/WebSites/CorsMiddlewareWebSite/CorsMiddlewareWebSite.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - b42d4844-fff8-4ec2-88d1-3ae95234d9eb - ..\..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - 41642 - - - \ No newline at end of file diff --git a/test/WebSites/CorsMiddlewareWebSite/Startup.cs b/test/WebSites/CorsMiddlewareWebSite/Startup.cs deleted file mode 100644 index c4cd5d4dc9..0000000000 --- a/test/WebSites/CorsMiddlewareWebSite/Startup.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.Builder; -using Microsoft.Extensions.DependencyInjection; - -namespace CorsMiddlewareWebSite -{ - public class Startup - { - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - app.UseCors(policy => policy.WithOrigins("http://example.com")); - app.UseMvc(); - } - } -} \ No newline at end of file diff --git a/test/WebSites/CorsMiddlewareWebSite/project.json b/test/WebSites/CorsMiddlewareWebSite/project.json deleted file mode 100644 index 3246ef254d..0000000000 --- a/test/WebSites/CorsMiddlewareWebSite/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": { - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Cors": "6.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" -} \ No newline at end of file diff --git a/test/WebSites/CorsMiddlewareWebSite/readme.md b/test/WebSites/CorsMiddlewareWebSite/readme.md deleted file mode 100644 index d7f8b28106..0000000000 --- a/test/WebSites/CorsMiddlewareWebSite/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -CorsMiddlewareWebSite -=== - -This web site illustrates how to use CorsMiddleware to apply a policy for entire application. diff --git a/test/WebSites/CorsMiddlewareWebSite/wwwroot/HelloWorld.htm b/test/WebSites/CorsMiddlewareWebSite/wwwroot/HelloWorld.htm deleted file mode 100644 index 3da1ec26e9..0000000000 --- a/test/WebSites/CorsMiddlewareWebSite/wwwroot/HelloWorld.htm +++ /dev/null @@ -1 +0,0 @@ -HelloWorld diff --git a/test/WebSites/FilesWebSite/SendFileMiddleware.cs b/test/WebSites/FilesWebSite/SendFileMiddleware.cs deleted file mode 100644 index 637a1f0aae..0000000000 --- a/test/WebSites/FilesWebSite/SendFileMiddleware.cs +++ /dev/null @@ -1,73 +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.IO; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Http.Features; -using Microsoft.Extensions.PlatformAbstractions; - -namespace FilesWebSite -{ - public class SendFileMiddleware - { - private const int DefaultBufferSize = 0x1000; - - private readonly RequestDelegate _next; - - public SendFileMiddleware(RequestDelegate next) - { - _next = next; - } - - public async Task Invoke(HttpContext context) - { - var environment = (IApplicationEnvironment)context.RequestServices.GetService(typeof(IApplicationEnvironment)); - - if (context.Features.Get() == null) - { - var sendFile = new SendFileFallBack(context.Response.Body, environment.ApplicationBasePath); - context.Features.Set(sendFile); - } - - await _next(context); - } - - private class SendFileFallBack : IHttpSendFileFeature - { - private readonly string _appBasePath; - private Stream _responseStream; - - public SendFileFallBack(Stream responseStream, string appBasePath) - { - _responseStream = responseStream; - _appBasePath = appBasePath; - } - - public async Task SendFileAsync(string path, long offset, long? length, CancellationToken cancellation) - { - using (var stream = new FileStream(Path.Combine(_appBasePath, path), FileMode.Open)) - { - length = length ?? stream.Length - offset; - - stream.Seek(offset, SeekOrigin.Begin); - - var bufferSize = length < DefaultBufferSize ? length.Value : DefaultBufferSize; - var buffer = new byte[bufferSize]; - var bytesRead = 0; - - do - { - var bytesToRead = bufferSize < length ? bufferSize : length; - bytesRead = await stream.ReadAsync(buffer, 0, (int)bytesToRead); - length = length - bytesRead; - - await _responseStream.WriteAsync(buffer, 0, bytesRead); - } while (bytesRead > 0 && length > 0); - } - } - } - } -} \ No newline at end of file diff --git a/test/WebSites/FilesWebSite/Startup.cs b/test/WebSites/FilesWebSite/Startup.cs index a5faa38a61..aa4b32b30c 100644 --- a/test/WebSites/FilesWebSite/Startup.cs +++ b/test/WebSites/FilesWebSite/Startup.cs @@ -18,8 +18,6 @@ namespace FilesWebSite { app.UseCultureReplacer(); - app.UseMiddleware(); - app.UseMvc(routes => { routes.MapRoute(name: null, template: "{controller}/{action}", defaults: null);