Skip to content

Instantly share code, notes, and snippets.

@RedGhoul
Last active July 7, 2019 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedGhoul/bc904041f1ebaca77a00d20bead2f778 to your computer and use it in GitHub Desktop.
Save RedGhoul/bc904041f1ebaca77a00d20bead2f778 to your computer and use it in GitHub Desktop.
public class LoanFormShould
{
[Fact]
public async Task RenderApplicationForm()
{
// Creating a web Host Builder to put in your test server
var builder = new WebHostBuilder()
.UseContentRoot(@"Enter your Path here to project")
.UseEnvironment("Development")
.UseStartup<loans.Startup>()
.UseApplicationInsights(); // Only need this if your using that feature
var server = new TestServer(builder);
var client = server.CreateClient(); // creating a client to make a request
var response = await client.GetAsync("/Apply");
response.EnsureSuccessStatusCode();
var responseString = await response.Content.ReadAsStringAsync(); // Getting the string of HTML
Assert.Contains("New Loan Application", responseString); // Using the Assert Contains to see if the has the right title
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment