Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. public class LoanFormShould
  2. {
  3. [Fact]
  4. public async Task RenderApplicationForm()
  5. {
  6. // Creating a web Host Builder to put in your test server
  7. var builder = new WebHostBuilder()
  8. .UseContentRoot(@"Enter your Path here to project")
  9. .UseEnvironment("Development")
  10. .UseStartup<loans.Startup>()
  11. .UseApplicationInsights(); // Only need this if your using that feature
  12.  
  13. var server = new TestServer(builder);
  14.  
  15. var client = server.CreateClient(); // creating a client to make a request
  16.  
  17. var response = await client.GetAsync("/Apply");
  18.  
  19. response.EnsureSuccessStatusCode();
  20.  
  21. var responseString = await response.Content.ReadAsStringAsync(); // Getting the string of HTML
  22.  
  23. Assert.Contains("New Loan Application", responseString); // Using the Assert Contains to see if the has the right title
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement