Removed TempDataWebsite and merged to BasicWebsite and fixed tests
This commit is contained in:
parent
3c694ce77c
commit
9288ab1a34
17
Mvc.sln
17
Mvc.sln
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24711.0
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}"
|
||||
EndProject
|
||||
|
|
@ -122,8 +122,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "BestEffortLinkGenerationWeb
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LowercaseUrlsWebSite", "test\WebSites\LowercaseUrlsWebSite\LowercaseUrlsWebSite.xproj", "{BCDB13A6-7D6E-485E-8424-A156432B71AC}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TempDataWebSite", "test\WebSites\TempDataWebSite\TempDataWebSite.xproj", "{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.TestCommon", "test\Microsoft.AspNet.Mvc.TestCommon\Microsoft.AspNet.Mvc.TestCommon.xproj", "{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CorsWebSite", "test\WebSites\CorsWebSite\CorsWebSite.xproj", "{94BA134D-04B3-48AA-BA55-5A4DB8640F2D}"
|
||||
|
|
@ -754,18 +752,6 @@ Global
|
|||
{BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BCDB13A6-7D6E-485E-8424-A156432B71AC}.Release|x86.Build.0 = Release|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F504357E-C2E1-4818-BA5C-9A2EAC25FEE5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
|
|
@ -1136,7 +1122,6 @@ Global
|
|||
{A19022EF-9BA3-4349-94E4-F48E13E1C8AE} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
|
||||
{B11C99C9-E577-4CA2-AC53-4F20EA71AD34} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
|
||||
{BCDB13A6-7D6E-485E-8424-A156432B71AC} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
|
||||
{8AEB631E-AB74-4D2E-83FB-8931EE10D9D3} = {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}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||
{
|
||||
public class TempDataTest : IClassFixture<MvcTestFixture<TempDataWebSite.Startup>>
|
||||
public class TempDataTest : IClassFixture<MvcTestFixture<BasicWebSite.Startup>>
|
||||
{
|
||||
public TempDataTest(MvcTestFixture<TempDataWebSite.Startup> fixture)
|
||||
public TempDataTest(MvcTestFixture<BasicWebSite.Startup> fixture)
|
||||
{
|
||||
Client = fixture.Client;
|
||||
}
|
||||
|
|
@ -34,13 +34,13 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
var content = new FormUrlEncodedContent(nameValueCollection);
|
||||
|
||||
// Act 1
|
||||
var response = await Client.PostAsync("/Home/SetTempData", content);
|
||||
var response = await Client.PostAsync("/TempData/SetTempData", content);
|
||||
|
||||
// Assert 1
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
// Act 2
|
||||
response = await Client.SendAsync(GetRequest("Home/GetTempData", response));
|
||||
response = await Client.SendAsync(GetRequest("TempData/GetTempData", response));
|
||||
|
||||
// Assert 2
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
Assert.Equal("Foo", body);
|
||||
|
||||
// Act 3
|
||||
response = await Client.SendAsync(GetRequest("Home/GetTempData", response));
|
||||
response = await Client.SendAsync(GetRequest("TempData/GetTempData", response));
|
||||
|
||||
// Assert 3
|
||||
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
|
||||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
var content = new FormUrlEncodedContent(nameValueCollection);
|
||||
|
||||
// Act
|
||||
var response = await Client.PostAsync("http://localhost/Home/DisplayTempData", content);
|
||||
var response = await Client.PostAsync("http://localhost/TempData/DisplayTempData", content);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
|
@ -86,13 +86,13 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
var content = new FormUrlEncodedContent(nameValueCollection);
|
||||
|
||||
// Act 1
|
||||
var response = await Client.PostAsync("/Home/SetTempData", content);
|
||||
var response = await Client.PostAsync("/TempData/SetTempData", content);
|
||||
|
||||
// Assert 1
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
// Act 2
|
||||
var redirectResponse = await Client.SendAsync(GetRequest("/Home/GetTempDataAndRedirect", response));
|
||||
var redirectResponse = await Client.SendAsync(GetRequest("/TempData/GetTempDataAndRedirect", response));
|
||||
|
||||
// Assert 2
|
||||
Assert.Equal(HttpStatusCode.Redirect, redirectResponse.StatusCode);
|
||||
|
|
@ -117,13 +117,13 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
var content = new FormUrlEncodedContent(nameValueCollection);
|
||||
|
||||
// Act 1
|
||||
var response = await Client.PostAsync("/Home/SetTempData", content);
|
||||
var response = await Client.PostAsync("/TempData/SetTempData", content);
|
||||
|
||||
// Assert 1
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
// Act 2
|
||||
var peekResponse = await Client.SendAsync(GetRequest("/Home/PeekTempData", response));
|
||||
var peekResponse = await Client.SendAsync(GetRequest("/TempData/PeekTempData", response));
|
||||
|
||||
// Assert 2
|
||||
Assert.Equal(HttpStatusCode.OK, peekResponse.StatusCode);
|
||||
|
|
@ -131,7 +131,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
Assert.Equal("Foo", body);
|
||||
|
||||
// Act 3
|
||||
var getResponse = await Client.SendAsync(GetRequest("/Home/GetTempData", response));
|
||||
var getResponse = await Client.SendAsync(GetRequest("/TempData/GetTempData", response));
|
||||
|
||||
// Assert 3
|
||||
Assert.Equal(HttpStatusCode.OK, getResponse.StatusCode);
|
||||
|
|
@ -159,7 +159,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
var content = new FormUrlEncodedContent(nameValueCollection);
|
||||
|
||||
// Act 1
|
||||
var redirectResponse = await Client.PostAsync("/Home/SetTempDataMultiple", content);
|
||||
var redirectResponse = await Client.PostAsync("/TempData/SetTempDataMultiple", content);
|
||||
|
||||
// Assert 1
|
||||
Assert.Equal(HttpStatusCode.Redirect, redirectResponse.StatusCode);
|
||||
|
|
@ -186,10 +186,10 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
// Act & Assert
|
||||
var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
{
|
||||
await Client.PostAsync("/Home/SetTempDataInvalidType", content);
|
||||
await Client.PostAsync("/TempData/SetTempDataInvalidType", content);
|
||||
});
|
||||
Assert.Equal("The '" + typeof(SessionStateTempDataProvider).FullName + "' cannot serialize an object of type '" +
|
||||
typeof(TempDataWebSite.Controllers.HomeController.NonSerializableType).FullName + "' to session state.", exception.Message);
|
||||
typeof(BasicWebSite.Controllers.TempDataController.NonSerializableType).FullName + "' to session state.", exception.Message);
|
||||
}
|
||||
|
||||
private HttpRequestMessage GetRequest(string path, HttpResponseMessage response)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
"RoutingWebSite": "1.0.0",
|
||||
"TagHelperSample.Web": "1.0.0",
|
||||
"TagHelpersWebSite": "1.0.0",
|
||||
"TempDataWebSite": "1.0.0",
|
||||
"UrlHelperWebSite": "1.0.0",
|
||||
"ValidationWebSite": "1.0.0",
|
||||
"ValueProvidersWebSite": "1.0.0",
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace TempDataWebSite.Controllers
|
||||
namespace BasicWebSite.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
public class TempDataController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
|
|
@ -20,6 +20,8 @@ namespace BasicWebSite
|
|||
services.AddSingleton<IActionDescriptorProvider, ActionDescriptorCreationCounter>();
|
||||
|
||||
services.AddScoped<RequestIdService>();
|
||||
services.AddCaching();
|
||||
services.AddSession();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
|
|
@ -29,6 +31,8 @@ namespace BasicWebSite
|
|||
// Initializes the RequestId service for each request
|
||||
app.UseMiddleware<RequestIdMiddleware>();
|
||||
|
||||
app.UseSession();
|
||||
|
||||
// Add MVC to the request pipeline
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@
|
|||
"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.Kestrel": "1.0.0-*",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
|
||||
"Microsoft.AspNet.Session": "1.0.0-*",
|
||||
"Microsoft.AspNet.StaticFiles": "1.0.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace TempDataWebSite
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
// Set up application services
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCaching();
|
||||
services.AddSession();
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.UseCultureReplacer();
|
||||
|
||||
app.UseSession();
|
||||
app.UseMvcWithDefaultRoute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>8aeb631e-ab74-4d2e-83fb-8931ee10d9d3</ProjectGuid>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<DevelopmentServerPort>28690</DevelopmentServerPort>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
|
|
@ -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.Session": "1.0.0-*",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
},
|
||||
"webroot": "wwwroot"
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
TempDataWebSite
|
||||
===
|
||||
|
||||
This web site illustrates use cases of TempData.
|
||||
|
|
@ -1 +0,0 @@
|
|||
HelloWorld
|
||||
Loading…
Reference in New Issue