This commit is contained in:
Stefan Dragnev 2016-01-07 10:16:16 +02:00
Родитель 67bcffab06
Коммит fa9f92dc3b
3 изменённых файлов: 4 добавлений и 19 удалений

Просмотреть файл

@ -1000,22 +1000,4 @@ namespace Telerik.JustMock.Tests
IEnumerable<string> GetValuesSince(DateTime since);
}
}
[TestClass]
public class MockingContextFixture
{
[TestMethod]
public void ShouldDisallowCallingOfTestMethodFromAnotherInner()
{
Mock.Create<object>();
}
[TestMethod]
public void ShouldDisallowCallingOfTestMethodFromAnother()
{
var ex = Assert.Throws<MockException>(() => ShouldDisallowCallingOfTestMethodFromAnotherInner());
var expected = "Calling one test method from another could result in unexpected behavior and must be avoided. Extract common mocking logic in a non-test method.";
Assert.Equal(expected, ex.Message);
}
}
}

Просмотреть файл

@ -114,7 +114,8 @@ namespace Telerik.JustMock.Core.Context
var allTestMethods = q.Distinct().ToArray();
if (allTestMethods.Length > 1)
{
Debug.WriteLine("Calling one test method from another could result in unexpected behavior and must be avoided. Extract common mocking logic in a non-test method. At:\n" + stackTrace);
var message = "Calling one test method from another could result in unexpected behavior and must be avoided. Extract common mocking logic to a non-test method. At:\n" + stackTrace;
DebugView.DebugTrace(message);
}
var testMethod = allTestMethods.FirstOrDefault();

Просмотреть файл

@ -182,6 +182,8 @@ namespace Telerik.JustMock
DynamicProxyMockFactory.SaveAssembly();
}
#endif
internal static Action<string> DebugTrace = s => System.Diagnostics.Trace.WriteLine(s);
}
}