You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This functionality worked in 4.2.1409 and below, but fail with 4.2.1502 and beyond.
Here is a series of tests that show the specific issue:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
public interface IRoot1
{
int Value { get; }
}
public interface IRoot2
{
int Value { get; set; }
}
public interface IDerived1 : IRoot1
{
int Value { get; set; }
}
public interface IDerived2 : IRoot2
{
int Value { get; set; }
}
public class Implementation1 : IDerived1
{
public int Value { get; set; }
}
public class Implementation2 : IDerived1
{
public int Value { get; set; }
}
[TestClass]
public class UnitTest1
{
private const int EXPECTED = int.MaxValue;
[TestMethod]
public void Root1Test()
{
var mock = Mock.Of<IRoot1>(c => c.Value == EXPECTED);
Assert.AreEqual(EXPECTED, mock.Value);
}
[TestMethod]
public void Derived1Test()
{
var mock = Mock.Of<IDerived1>(c => c.Value == EXPECTED);
Assert.AreEqual(EXPECTED, mock.Value);
}
[TestMethod]
public void Implementation1Test()
{
var mock = Mock.Of<Implementation1>(c => c.Value == EXPECTED);
Assert.AreEqual(EXPECTED, mock.Value);
}
[TestMethod]
public void Root2Test()
{
var mock = Mock.Of<IRoot2>(c => c.Value == EXPECTED);
Assert.AreEqual(EXPECTED, mock.Value);
}
[TestMethod]
public void Derived2Test()
{
var mock = Mock.Of<IDerived2>(c => c.Value == EXPECTED);
Assert.AreEqual(EXPECTED, mock.Value);
}
[TestMethod]
public void Implementation2Test()
{
var mock = Mock.Of<Implementation2>(c => c.Value == EXPECTED);
Assert.AreEqual(EXPECTED, mock.Value);
}
}
All tests pass except Derived1Test. The implementation class always works, and the root interface always works. The only thing that breaks here is when a derived interface declares a read/write property when the root interface declares the same property as read-only.
The text was updated successfully, but these errors were encountered:
This functionality worked in 4.2.1409 and below, but fail with 4.2.1502 and beyond.
Here is a series of tests that show the specific issue:
All tests pass except Derived1Test. The implementation class always works, and the root interface always works. The only thing that breaks here is when a derived interface declares a read/write property when the root interface declares the same property as read-only.
The text was updated successfully, but these errors were encountered: