Clean up MvcSandbox (#12542)
This commit is contained in:
parent
6526022f6c
commit
a181fc2b67
|
|
@ -7,8 +7,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.AspNetCore.Mvc" />
|
<Reference Include="Microsoft.AspNetCore.Mvc" />
|
||||||
<Reference Include="Microsoft.AspNetCore.Mvc.Components.Prerendering" />
|
<Reference Include="Microsoft.AspNetCore.Mvc.Components.Prerendering" />
|
||||||
<Reference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" />
|
|
||||||
<Reference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" />
|
|
||||||
<Reference Include="Microsoft.AspNetCore.Components.Server" />
|
<Reference Include="Microsoft.AspNetCore.Components.Server" />
|
||||||
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
|
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
|
||||||
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
|
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
|
||||||
|
|
|
||||||
|
|
@ -11,21 +11,7 @@
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="row">
|
<div class="text-center">
|
||||||
<div class="col-md-3">
|
<h1 class="display-4">Pages Home</h1>
|
||||||
<h2>RazorPages says Hello @Model.Name!</h2>
|
<p>This sandbox should give you a quick view of a basic MVC application.</p>
|
||||||
<ul>
|
</div>
|
||||||
<li>This file should give you a quick view of a Mvc Razor Page in action.</li>
|
|
||||||
</ul>
|
|
||||||
<p>Message from TempData: @Message</p>
|
|
||||||
@{
|
|
||||||
Message = $"You visited this page at {DateTime.Now}.";
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="post">
|
|
||||||
<label>Say hello to <input type="text" name="name" /></label>
|
|
||||||
<input type="submit" value="Say" />
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
@ -5,7 +5,6 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
@ -28,7 +27,6 @@ namespace MvcSandbox
|
||||||
});
|
});
|
||||||
services.AddServerSideBlazor();
|
services.AddServerSideBlazor();
|
||||||
services.AddMvc()
|
services.AddMvc()
|
||||||
.AddRazorRuntimeCompilation()
|
|
||||||
.SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Latest);
|
.SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Latest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,7 @@
|
||||||
ViewData["Title"] = "Home Page";
|
ViewData["Title"] = "Home Page";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="row">
|
<div class="text-center">
|
||||||
<div class="col-md-3">
|
<h1 class="display-4">Sandbox</h1>
|
||||||
<h2>Sandbox</h2>
|
<p>This sandbox should give you a quick view of a basic MVC application.</p>
|
||||||
<ul>
|
|
||||||
<li>This sandbox should give you a quick view of a basic MVC application.</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,39 +4,34 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - MvcSandbox</title>
|
<title>@ViewData["Title"] - MvcSandbox</title>
|
||||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
<header>
|
||||||
<div class="container">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||||
<div class="navbar-header">
|
<div class="container">
|
||||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">MvcSandbox</a>
|
||||||
<span class="sr-only">Toggle navigation</span>
|
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
|
||||||
<span class="icon-bar"></span>
|
<ul class="navbar-nav flex-grow-1">
|
||||||
<span class="icon-bar"></span>
|
<li class="nav-item">
|
||||||
<span class="icon-bar"></span>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||||
</button>
|
</li>
|
||||||
<a asp-controller="Home" asp-action="Index" class="navbar-brand">MvcSandbox</a>
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/PagesHome">Pages Home</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse">
|
</nav>
|
||||||
<ul class="nav navbar-nav">
|
</header>
|
||||||
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
|
<div class="container">
|
||||||
<li><a asp-page="/PagesHome">PagesHome</a></li>
|
<main role="main" class="pb-3">
|
||||||
</ul>
|
@RenderBody()
|
||||||
</div>
|
</main>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="container body-content">
|
|
||||||
@RenderBody()
|
|
||||||
<hr />
|
|
||||||
<footer>
|
|
||||||
<p>© 2015 - MvcSandbox</p>
|
|
||||||
</footer>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js"></script>
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
@RenderSection("scripts", required: false)
|
@RenderSection("scripts", required: false)
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
@ -20,19 +21,20 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
public async Task Home_Pages_ReturnSuccess()
|
public async Task Home_Pages_ReturnSuccess()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetStringAsync("http://localhost");
|
var response = await Client.GetAsync("http://localhost");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Contains("This sandbox should give you a quick view of a basic MVC application.", response);
|
await response.AssertStatusCodeAsync(HttpStatusCode.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task RazorPages_ReturnSuccess()
|
public async Task RazorPages_ReturnSuccess()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetStringAsync("http://localhost/PagesHome");
|
var response = await Client.GetAsync("http://localhost/PagesHome");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Contains("This file should give you a quick view of a Mvc Razor Page in action.", response);
|
await response.AssertStatusCodeAsync(HttpStatusCode.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue