Implement `OwinEnvironment` `IEnumerable.GetEnumerator()` (#789)

This commit is contained in:
kchanlee 2017-03-13 22:54:57 +08:00 committed by Chris R
parent fc3af1ecfe
commit 1b02cd2baf
2 changed files with 12 additions and 2 deletions

View File

@ -270,7 +270,7 @@ namespace Microsoft.AspNetCore.Owin
throw new NotImplementedException();
}
IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
foreach (var entryPair in _entries)
{
@ -288,7 +288,7 @@ namespace Microsoft.AspNetCore.Owin
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
return GetEnumerator();
}
public class FeatureMap

View File

@ -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;
@ -129,6 +130,15 @@ namespace Microsoft.AspNetCore.Owin
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();