private static string GenerateIncorrectLocationMessage(HttpResult result, Uri targetLocation)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
var lastOutcome = result.Outcomes.Last();
var outcomes = result.Outcomes.Aggregate(string.Empty, (x, y) => x + Environment.NewLine + y);
// We have been requested to go to a location that doesn't match the requested page
var message = string.Format(
CultureInfo.CurrentCulture,
Resources.HttpOutcomeException_InvalidLocation,
lastOutcome.Location,
targetLocation,
outcomes);
return message;
}