HomeController_Tests.cs 727 B

1234567891011121314151617181920212223242526272829
  1. using System.Threading.Tasks;
  2. using YGNT.Exam.Models.TokenAuth;
  3. using YGNT.Exam.Web.Controllers;
  4. using Shouldly;
  5. using Xunit;
  6. namespace YGNT.Exam.Web.Tests.Controllers
  7. {
  8. public class HomeController_Tests: ExamWebTestBase
  9. {
  10. [Fact]
  11. public async Task Index_Test()
  12. {
  13. await AuthenticateAsync(null, new AuthenticateModel
  14. {
  15. UserNameOrEmailAddress = "admin",
  16. Password = "123qwe"
  17. });
  18. //Act
  19. var response = await GetResponseAsStringAsync(
  20. GetUrl<HomeController>(nameof(HomeController.Index))
  21. );
  22. //Assert
  23. response.ShouldNotBeNullOrEmpty();
  24. }
  25. }
  26. }