I am moving and refactoring a code from .NET-Framework to .NET-Core in C#. When I run a simple test on a method which is supposed to sort a List, I get this error:
"System.MissingMethodException: Method not found: 'System.Collections.IDictionary Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.get_Properties()'."
I have checked references to other namespaces that are necessary. I searched for the error online and I realized that the TestContext Class has not been provided in .NET Core yet! Is there another way or a replacement library I can use instead? Thank you.
[TestMethod]
public void TestMethod()
{
// Arrange
// Grab an arbitrary start time.
Time startTime = Time.Now;
List<TimeValue> values = new List<TimeValue>
{
// Make sure that second timestamp comes before the first
timestamp
new TimeValue(startTime.PlusMinutes(1)),
new TimeValue(startTime)
};
// Ensure that this is sorted in ascending order of time.
List<TimeValue> expectedValues = values.OrderBy(value =>
value.Timestamp).ToList();
CollectionAssert.AreNotEqual(expectedValues, values);
// Act
SortArray myObj = new SortArray(values);
// Assert
CollectionAssert.AreEqual(expectedValues, SortArray.Values);
}
I expect the TestMethod to run, but it does not run and gives me the following error:
'System.Collections.IDictionary Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.get_Properties()'.