Skip to content

Commit

Permalink
Removed TempDataWebsite and merged to BasicWebsite and fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kichalla committed Dec 3, 2015
1 parent 3c694ce commit 9288ab1
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 103 deletions.
17 changes: 1 addition & 16 deletions Mvc.sln
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
28 changes: 14 additions & 14 deletions test/Microsoft.AspNet.Mvc.FunctionalTests/TempDataTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

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;
}
Expand All @@ -34,21 +34,21 @@ public async Task TempData_PersistsJustForNextRequest()
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);
var body = await response.Content.ReadAsStringAsync();
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);
Expand All @@ -65,7 +65,7 @@ public async Task ViewRendersTempData()
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);
Expand All @@ -86,13 +86,13 @@ public async Task Redirect_RetainsTempData_EvenIfAccessed()
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);
Expand All @@ -117,21 +117,21 @@ public async Task Peek_RetainsTempData()
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);
var body = await peekResponse.Content.ReadAsStringAsync();
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);
Expand Down Expand Up @@ -159,7 +159,7 @@ public async Task TempData_ValidTypes_RoundTripProperly()
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);
Expand All @@ -186,10 +186,10 @@ public async Task TempData_InvalidType_Throws()
// 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)
Expand Down
1 change: 0 additions & 1 deletion test/Microsoft.AspNet.Mvc.FunctionalTests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
{
Expand Down
4 changes: 4 additions & 0 deletions test/WebSites/BasicWebSite/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddSingleton<IActionDescriptorProvider, ActionDescriptorCreationCounter>();

services.AddScoped<RequestIdService>();
services.AddCaching();
services.AddSession();
}

public void Configure(IApplicationBuilder app)
Expand All @@ -29,6 +31,8 @@ public void Configure(IApplicationBuilder app)
// Initializes the RequestId service for each request
app.UseMiddleware<RequestIdMiddleware>();

app.UseSession();

// Add MVC to the request pipeline
app.UseMvc(routes =>
{
Expand Down
3 changes: 2 additions & 1 deletion test/WebSites/BasicWebSite/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
27 changes: 0 additions & 27 deletions test/WebSites/TempDataWebSite/Startup.cs

This file was deleted.

18 changes: 0 additions & 18 deletions test/WebSites/TempDataWebSite/TempDataWebSite.xproj

This file was deleted.

18 changes: 0 additions & 18 deletions test/WebSites/TempDataWebSite/project.json

This file was deleted.

4 changes: 0 additions & 4 deletions test/WebSites/TempDataWebSite/readme.md

This file was deleted.

1 change: 0 additions & 1 deletion test/WebSites/TempDataWebSite/wwwroot/HelloWorld.htm

This file was deleted.

0 comments on commit 9288ab1

Please sign in to comment.