Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Updated the desktop implementation as well.
  • Loading branch information
cltshivash committed Feb 8, 2019
commit 4c01db8cabc9ff1a9a62f3d0c0aea5616ee6db8b
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ public override DataRow DataRow
}

/// <inheritdoc/>
public override IDictionary<string, object> Properties
public override IDictionary Properties
{
get
{
return this.properties;
return this.properties as IDictionary;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/TestFramework/Extension.Desktop/TestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Microsoft.VisualStudio.TestTools.UnitTesting
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
Expand All @@ -19,7 +20,7 @@ public abstract class TestContext
/// <summary>
/// Gets test properties for a test.
/// </summary>
public abstract IDictionary<string, object> Properties { get; }
public abstract IDictionary Properties { get; }

/// <summary>
/// Gets the current data row when test is used for data driven testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public void TestContextConstructorShouldInitializeDefaultProperties()
Assert.IsNotNull(this.testContextImplementation.Properties);

CollectionAssert.Contains(
this.testContextImplementation.Properties.ToList(),
((IDictionary<string, object>)this.testContextImplementation.Properties).ToList(),
new KeyValuePair<string, object>("FullyQualifiedTestClassName", "A.C.M"));
CollectionAssert.Contains(
this.testContextImplementation.Properties.ToList(),
((IDictionary<string, object>)this.testContextImplementation.Properties).ToList(),
new KeyValuePair<string, object>("TestName", "M"));
}

Expand Down Expand Up @@ -115,8 +115,9 @@ public void PropertiesShouldReturnPropertiesPassedToTestContext()

this.testContextImplementation = new TestContextImplementation(this.testMethod.Object, new System.IO.StringWriter(), this.properties);

CollectionAssert.Contains(this.testContextImplementation.Properties.ToList(), property1);
CollectionAssert.Contains(this.testContextImplementation.Properties.ToList(), property2);
var propertyList = ((IDictionary<string, object>)this.testContextImplementation.Properties).ToList();
CollectionAssert.Contains(propertyList, property1);
CollectionAssert.Contains(propertyList, property2);
}

[TestMethod]
Expand Down Expand Up @@ -158,11 +159,10 @@ public void TryGetPropertyValueShouldReturnFalseIfPropertyIsNotPresent()
public void AddPropertyShouldAddPropertiesToThePropertyBag()
{
this.testContextImplementation = new TestContextImplementation(this.testMethod.Object, new System.IO.StringWriter(), this.properties);

this.testContextImplementation.AddProperty("SomeNewProperty", "SomeValue");

CollectionAssert.Contains(
this.testContextImplementation.Properties.ToList(),
((IDictionary<string, object>)this.testContextImplementation.Properties).ToList(),
new KeyValuePair<string, object>("SomeNewProperty", "SomeValue"));
}

Expand Down