public void Can_Get_Authorization_Results() { var authorizationStates = AcmeClientService.RequestVerificationChallenge(TargetApplication).ToList(); Assert.IsNotEmpty(authorizationStates); foreach (var authorizationState in authorizationStates) { // Make sure the hostname in the authorization result is one that we actually sent in Assert.IsTrue(TargetApplication.Hostnames.Any(x => string.Equals(x, authorizationState.Identifier, StringComparison.InvariantCultureIgnoreCase))); // Since we can't authorize using HTTP from a unit test we'll be happy if all tests end in a pending status Assert.AreEqual(authorizationState.Status, AuthorizationState.STATUS_PENDING); } }
public void Can_Handle_Authorization_Challenge() { var authorizationStates = AcmeClientService.RequestVerificationChallenge(TargetApplication).ToList(); Assert.IsNotEmpty(authorizationStates); var hanledAuthorizationStates = new List <AuthorizationState>(); foreach (var authorizationState in authorizationStates) { hanledAuthorizationStates.Add(AcmeClientService.HandleVerificationChallenge(authorizationState)); } foreach (var authorizationState in hanledAuthorizationStates) { Assert.AreEqual(authorizationState.Status, AuthorizationState.STATUS_VALID); } }