public void ExtractTokenThrowsTokenExtractionFailedException() { var configuration = Program.BuildServiceProvider().GetService <UdemyRegexConfigurationSection>(); var content = "no csrf token available"; var tokenExtractor = new CsrfTokenExtractor(configuration); Assert.ThrowsException <TokenExtractionFailedException>(() => tokenExtractor.GetToken(content)); }
public async Task CanExtractTokenFromOrganizationUdemy() { var configuration = Program.BuildServiceProvider().GetService <UdemyRegexConfigurationSection>(); var fileContent = await File.ReadAllTextAsync(UdemyOrganizationLoginPageFilename); var tokenExtractor = new CsrfTokenExtractor(configuration); var token = tokenExtractor.GetToken(fileContent); Assert.AreEqual("cgz3NkDfFyolSajU3GB5XZfhaVIWYYYt", token); }
public async Task CanExtractTokenFromPersonalUdemy() { var configuration = Program.BuildServiceProvider().GetService <UdemyRegexConfigurationSection>(); var fileContent = await File.ReadAllTextAsync(UdemyPersonalLoginPageFilename); var tokenExtractor = new CsrfTokenExtractor(configuration); var token = tokenExtractor.GetToken(fileContent); Assert.AreEqual("CiwL3eQE4xV8FynVCJw4XwYxwGzn4Ukr", token); }