Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
Add functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkm committed Sep 8, 2017
1 parent 26a7cde commit b8f61fd
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,18 @@ public async Task PageRoute_UsingDefaultPageNameToRoute()
// Assert
Assert.Equal(expected, response.Trim());
}

[Fact]
public async Task Pages_ReturnsFromPagesSharedDirectory()
{
// Arrange
var expected = "Hello from Pages/Shared";

// Act
var response = await Client.GetStringAsync("/SearchInPages");

// Assert
Assert.Equal(expected, response.Trim());
}
}
}
13 changes: 13 additions & 0 deletions test/Microsoft.AspNetCore.Mvc.FunctionalTests/ViewEngineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,5 +513,18 @@ public async Task ViewEngine_ResolvesPathsWithSlashesThatDoNotHaveExtensions()
// Assert
Assert.Equal(expected, responseContent.Trim());
}

[Fact]
public async Task ViewEngine_DiscoversViewsFromPagesSharedDirectory()
{
// Arrange
var expected = "Hello from Pages/Shared";

// Act
var responseContent = await Client.GetStringAsync("/ViewEngine/SearchInPages");

// Assert
Assert.Equal(expected, responseContent.Trim());
}
}
}
1 change: 1 addition & 0 deletions test/WebSites/RazorPagesWebSite/Pages/FileFromShared
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Html.Partial("_FileInShared)
2 changes: 2 additions & 0 deletions test/WebSites/RazorPagesWebSite/Pages/SearchInPages.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@page
@Html.Partial("_FileInShared")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello from Pages/Shared
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@{ throw new Exception("This file should not be processed"); }
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@ public IActionResult ViewWithComponentThatHasViewStart()
{
return View();
}

public IActionResult SearchInPages() => View();
}
}
1 change: 1 addition & 0 deletions test/WebSites/RazorWebSite/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@{ throw new Exception("This file should not be processed"); }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello from Pages/Shared

0 comments on commit b8f61fd

Please sign in to comment.