Last active
July 7, 2019 16:45
-
-
Save RedGhoul/bc904041f1ebaca77a00d20bead2f778 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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