Describe the bug
When calling method in expression, the output differs when I run an instance method, or static method, it also reports different amount of detail when using instance method on the same type (the test class), or on other type.
Making it hard to identify where the static method comes from, and overreporting on local methods on the test class.
Steps To Reproduce
using System.Diagnostics.CodeAnalysis;
namespace mstest280;
[TestClass]
public sealed class Test1
{
[TestMethod]
public void SameType_Instance()
{
string animal = "";
Assert.That(() => GetAnimal() == animal);
}
[TestMethod]
public void SameType_Static()
{
string animal = "";
Assert.That(() => GetAnimal2() == animal);
}
[TestMethod]
public void OtherType_Instance()
{
string animal = "";
var zoo = new Zoo();
Assert.That(() => zoo.GetAnimal() == animal);
}
[TestMethod]
public void OtherType_Static()
{
string animal = "";
Assert.That(() => Zoo.GetAnimal2() == animal);
}
public string GetAnimal()
{
return "Giraffe";
}
public static string GetAnimal2()
{
return "Giraffe";
}
}
public class Zoo
{
public string GetAnimal()
{
return "Giraffe";
}
public static string GetAnimal2()
{
return "Giraffe";
}
}
Expected behavior
We see
this.GetAnimal() <- instance on same type
Test1.GetAnimal2() <- static on same type
zoo.GetAnimal() <- instance on other type
Zoo.GetAnimal2() <- static on other type
Actual behavior
Failed SameType_Static [52 ms]
Error Message:
Assert.That(() => GetAnimal2() == animal) failed.
Details:
GetAnimal2() = "Giraffe" <- type is not seen
animal = ""
Failed SameType_Instance [52 ms]
Error Message:
Assert.That(() => GetAnimal() == animal) failed.
Details:
animal = ""
mstest280.Test1.GetAnimal() = "Giraffe" <- project name is seen
Failed OtherType_Instance [52 ms]
Error Message:
Assert.That(() => zoo.GetAnimal() == animal) failed.
Details:
animal = ""
zoo.GetAnimal() = "Giraffe" <- correct
Failed OtherType_Static [52 ms]
Error Message:
Assert.That(() => Zoo.GetAnimal2() == animal) failed.
Details:
GetAnimal2() = "Giraffe" <- type is not seen
animal = ""
Describe the bug
When calling method in expression, the output differs when I run an instance method, or static method, it also reports different amount of detail when using instance method on the same type (the test class), or on other type.
Making it hard to identify where the static method comes from, and overreporting on local methods on the test class.
Steps To Reproduce
Expected behavior
We see
Actual behavior