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

Commit 1b02cd2

Browse files
kchanleeTratcher
authored andcommitted
Implement OwinEnvironment IEnumerable.GetEnumerator() (#789)
1 parent fc3af1e commit 1b02cd2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, objec
270270
throw new NotImplementedException();
271271
}
272272

273-
IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
273+
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
274274
{
275275
foreach (var entryPair in _entries)
276276
{
@@ -288,7 +288,7 @@ IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, objec
288288

289289
IEnumerator IEnumerable.GetEnumerator()
290290
{
291-
throw new NotImplementedException();
291+
return GetEnumerator();
292292
}
293293

294294
public class FeatureMap

test/Microsoft.AspNetCore.Owin.Tests/OwinEnvironmentTests.cs

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System.Collections;
45
using System.Collections.Generic;
56
using System.IO;
67
using System.Linq;
@@ -129,6 +130,15 @@ public void OwinEnvironmentSuppliesDefaultsForMissingRequiredEntries()
129130
Assert.Equal("1.0", env["owin.Version"]);
130131
}
131132

133+
[Fact]
134+
public void OwinEnvironmentImpelmentsGetEnumerator()
135+
{
136+
var owinEnvironment = new OwinEnvironment(CreateContext());
137+
138+
Assert.NotNull(owinEnvironment.GetEnumerator());
139+
Assert.NotNull(((IEnumerable)owinEnvironment).GetEnumerator());
140+
}
141+
132142
private HttpContext CreateContext()
133143
{
134144
var context = new DefaultHttpContext();

0 commit comments

Comments
 (0)