diff --git a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs index b625eebbfc..e5ae798c05 100644 --- a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs +++ b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs @@ -118,11 +118,11 @@ public override DataRow DataRow } /// - public override IDictionary Properties + public override IDictionary Properties { get { - return this.properties as IDictionary; + return this.properties; } } diff --git a/src/TestFramework/Extension.Desktop/TestContext.cs b/src/TestFramework/Extension.Desktop/TestContext.cs index bd5d4b8fcd..2cefc01d8f 100644 --- a/src/TestFramework/Extension.Desktop/TestContext.cs +++ b/src/TestFramework/Extension.Desktop/TestContext.cs @@ -4,7 +4,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting { using System; - using System.Collections; + using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Diagnostics; @@ -19,7 +19,7 @@ public abstract class TestContext /// /// Gets test properties for a test. /// - public abstract IDictionary Properties { get; } + public abstract IDictionary Properties { get; } /// /// Gets the current data row when test is used for data driven testing. diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestContextImplTests.cs b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestContextImplTests.cs index beb84028a2..005b9c1c3d 100644 --- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestContextImplTests.cs +++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestContextImplTests.cs @@ -59,10 +59,10 @@ public void TestContextConstructorShouldInitializeDefaultProperties() Assert.IsNotNull(this.testContextImplementation.Properties); CollectionAssert.Contains( - this.testContextImplementation.Properties, + this.testContextImplementation.Properties.ToList(), new KeyValuePair("FullyQualifiedTestClassName", "A.C.M")); CollectionAssert.Contains( - this.testContextImplementation.Properties, + this.testContextImplementation.Properties.ToList(), new KeyValuePair("TestName", "M")); } @@ -115,8 +115,8 @@ public void PropertiesShouldReturnPropertiesPassedToTestContext() this.testContextImplementation = new TestContextImplementation(this.testMethod.Object, new System.IO.StringWriter(), this.properties); - CollectionAssert.Contains(this.testContextImplementation.Properties, property1); - CollectionAssert.Contains(this.testContextImplementation.Properties, property2); + CollectionAssert.Contains(this.testContextImplementation.Properties.ToList(), property1); + CollectionAssert.Contains(this.testContextImplementation.Properties.ToList(), property2); } [TestMethod] @@ -162,7 +162,7 @@ public void AddPropertyShouldAddPropertiesToThePropertyBag() this.testContextImplementation.AddProperty("SomeNewProperty", "SomeValue"); CollectionAssert.Contains( - this.testContextImplementation.Properties, + this.testContextImplementation.Properties.ToList(), new KeyValuePair("SomeNewProperty", "SomeValue")); }