Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Implement OwinEnvironment IEnumerable.GetEnumerator() #789

Merged
merged 3 commits into from
Mar 13, 2017

Conversation

kchanlee
Copy link
Contributor

@kchanlee kchanlee commented Mar 11, 2017

Implement OwinEnvironment IEnumerable.GetEnumerator()

Related to Issue 788

@dnfclas
Copy link

dnfclas commented Mar 11, 2017

@kchanlee,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

Looking good. Minor comments

[Fact]
public void OwinEnvironmentImpelmentsGetEnumerator()
{
HttpContext context = CreateContext();
Copy link
Contributor

Choose a reason for hiding this comment

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

style: use var whenever possible instead of the explicit type. I know that the rest of the test class doesn't follow this guideline but it's never too late to start.

Also, combine: var owinEnvironment = new OwinEnvironment(CreateContext());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

IEnumerator<KeyValuePair<string, object>> e1 = owinEnvironment.GetEnumerator();
Assert.NotNull(e1);

foreach (var kv in owinEnvironment) { } // This should not throw exception
Copy link
Contributor

Choose a reason for hiding this comment

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

These checks are not really useful. It's enough to check that the enumerators are not null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

HttpContext context = CreateContext();
OwinEnvironment owinEnvironment = new OwinEnvironment(context);

IEnumerator<KeyValuePair<string, object>> e1 = owinEnvironment.GetEnumerator();
Copy link
Contributor

Choose a reason for hiding this comment

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

Combine: Assert.NotNull(owinEnvironment.GetEnumerator());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, we'll merge soon.

@Tratcher Tratcher merged commit 1b02cd2 into aspnet:dev Mar 13, 2017
@kchanlee kchanlee deleted the FixOwinEnvironment branch March 14, 2017 00:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants