I have two very similar tests. One of them passes and one fails, throwing the exception "Cannot use WhenCalled without a complementing behavior statement." Here is a minimal repro:
namespace TypeMockReproTest
{
using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TypeMock.ArrangeActAssert;
[TestClass, Isolated]
public class TypemockReproTest
{
[TestMethod]
public void TestOne()
{
Isolate.Fake.StaticMethods(typeof(XElement), Members.CallOriginal);
Isolate.WhenCalled(() => XElement.Load((string)null)).WillReturn(XElement.Parse(string.Empty));
}
[TestMethod]
public void TestTwo()
{
Isolate.Fake.StaticMethods(typeof(XElement), Members.CallOriginal);
Isolate.WhenCalled(() => XElement.Load((string)null)).WillReturn(XElement.Parse("<foo>"));
}
}
}
Test One throws the exception and Test Two passes. Any ideas?
Thanks,
Larry