Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forms and Drugs endpoints #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

crobject
Copy link
Contributor

This pull request adds functionality for both the forms and the drugs endpoints. It allows for both searching and getting.

@twyfordr
Copy link

twyfordr commented Jun 7, 2016

Does this PR contain anything that #3 doesn't already have? I accidentally skipped this one in review. Also, it appears to be behind master.

@crobject
Copy link
Contributor Author

crobject commented Jun 7, 2016

@twyfordr Yes, #3 was based on this PR, so #3 it builds on this one.

Assert.That(_searchFormSimple.Parameters.Any(p => p.Name == "Authorization" &&
p.Value.ToString() == string.Format("Bearer {0}+x-no-pass", _apiId)));
Assert.That(_searchFormComplex.Parameters.Any(p => p.Name == "Authorization" &&
p.Value.ToString() == string.Format("Bearer {0}+x-no-pass", _apiId)));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a private helper method could dry some of these up a bit.

private bool HasParameter(ParametersType params, string name, string value) {
  return params.Any(p=> p.Name == name && p.Value.ToString() == value;
}

Then your tests can be a little more concise:

var authValue = string.Format("Bearer {0}+x-no-pass", _apiId)
Assert.That(HasParameter(_searchFormSimple.Parameters, "Authorization", authValue));
Assert.That(HasParameter(_searchFormComplex.Parameters, "Authorization", authValue));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants