Clean up MvcSandbox (#12542)

This commit is contained in:
Pranav K 2019-07-25 10:25:07 -07:00 committed by GitHub
parent 6526022f6c
commit a181fc2b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 61 deletions

View File

@ -7,8 +7,6 @@
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc" />
<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.Diagnostics" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />

View File

@ -11,21 +11,7 @@
public string Message { get; set; }
}
<div class="row">
<div class="col-md-3">
<h2>RazorPages says Hello @Model.Name!</h2>
<ul>
<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>
<div class="text-center">
<h1 class="display-4">Pages Home</h1>
<p>This sandbox should give you a quick view of a basic MVC application.</p>
</div>

View File

@ -5,7 +5,6 @@ using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -28,7 +27,6 @@ namespace MvcSandbox
});
services.AddServerSideBlazor();
services.AddMvc()
.AddRazorRuntimeCompilation()
.SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Latest);
}

View File

@ -2,11 +2,7 @@
ViewData["Title"] = "Home Page";
}
<div class="row">
<div class="col-md-3">
<h2>Sandbox</h2>
<ul>
<li>This sandbox should give you a quick view of a basic MVC application.</li>
</ul>
</div>
<div class="text-center">
<h1 class="display-4">Sandbox</h1>
<p>This sandbox should give you a quick view of a basic MVC application.</p>
</div>

View File

@ -4,39 +4,34 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<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>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-controller="Home" asp-action="Index" class="navbar-brand">MvcSandbox</a>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">MvcSandbox</a>
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/PagesHome">Pages Home</a>
</li>
</ul>
</div>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-page="/PagesHome">PagesHome</a></li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>&copy; 2015 - MvcSandbox</p>
</footer>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.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://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
@RenderSection("scripts", required: false)
</body>
</html>

View File

@ -1,6 +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.
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Xunit;
@ -20,19 +21,20 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
public async Task Home_Pages_ReturnSuccess()
{
// Arrange & Act
var response = await Client.GetStringAsync("http://localhost");
var response = await Client.GetAsync("http://localhost");
// Assert
Assert.Contains("This sandbox should give you a quick view of a basic MVC application.", response);
await response.AssertStatusCodeAsync(HttpStatusCode.OK);
}
[Fact]
public async Task RazorPages_ReturnSuccess()
{
// Arrange & Act
var response = await Client.GetStringAsync("http://localhost/PagesHome");
var response = await Client.GetAsync("http://localhost/PagesHome");
// Assert
Assert.Contains("This file should give you a quick view of a Mvc Razor Page in action.", response);
await response.AssertStatusCodeAsync(HttpStatusCode.OK);
}
}
}