Adding Tests and Refactoring
Functional Tests for RazorPages added
This commit is contained in:
29
tests/FunctionalTests/WebRazorPages/HomePageOnGet.cs
Normal file
29
tests/FunctionalTests/WebRazorPages/HomePageOnGet.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.eShopWeb.RazorPages;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace FunctionalTests.WebRazorPages
|
||||
{
|
||||
public class HomePageOnGet : IClassFixture<CustomWebRazorPagesApplicationFactory<Startup>>
|
||||
{
|
||||
public HomePageOnGet(CustomWebRazorPagesApplicationFactory<Startup> factory)
|
||||
{
|
||||
Client = factory.CreateClient();
|
||||
}
|
||||
|
||||
public HttpClient Client { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task ReturnsHomePageWithProductListing()
|
||||
{
|
||||
// Arrange & Act
|
||||
var response = await Client.GetAsync("/");
|
||||
response.EnsureSuccessStatusCode();
|
||||
var stringResponse = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// Assert
|
||||
Assert.Contains(".NET Bot Black Sweatshirt", stringResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user