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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, objec
throw new NotImplementedException();
}

IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
foreach (var entryPair in _entries)
{
Expand All @@ -288,7 +288,7 @@ IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, objec

IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
return GetEnumerator();
}

public class FeatureMap
Expand Down
10 changes: 10 additions & 0 deletions test/Microsoft.AspNetCore.Owin.Tests/OwinEnvironmentTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -129,6 +130,15 @@ public void OwinEnvironmentSuppliesDefaultsForMissingRequiredEntries()
Assert.Equal("1.0", env["owin.Version"]);
}

[Fact]
public void OwinEnvironmentImpelmentsGetEnumerator()
{
var owinEnvironment = new OwinEnvironment(CreateContext());

Assert.NotNull(owinEnvironment.GetEnumerator());
Assert.NotNull(((IEnumerable)owinEnvironment).GetEnumerator());
}

private HttpContext CreateContext()
{
var context = new DefaultHttpContext();
Expand Down