diff --git a/Telerik.JustMock.Tests/MiscFixture.cs b/Telerik.JustMock.Tests/MiscFixture.cs index 1923fa1..368aef6 100644 --- a/Telerik.JustMock.Tests/MiscFixture.cs +++ b/Telerik.JustMock.Tests/MiscFixture.cs @@ -1000,22 +1000,4 @@ namespace Telerik.JustMock.Tests IEnumerable GetValuesSince(DateTime since); } } - - [TestClass] - public class MockingContextFixture - { - [TestMethod] - public void ShouldDisallowCallingOfTestMethodFromAnotherInner() - { - Mock.Create(); - } - - [TestMethod] - public void ShouldDisallowCallingOfTestMethodFromAnother() - { - var ex = Assert.Throws(() => 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); - } - } } diff --git a/Telerik.JustMock/Core/Context/HierarchicalTestFrameworkContextResolver.cs b/Telerik.JustMock/Core/Context/HierarchicalTestFrameworkContextResolver.cs index 6c4dd33..a386364 100644 --- a/Telerik.JustMock/Core/Context/HierarchicalTestFrameworkContextResolver.cs +++ b/Telerik.JustMock/Core/Context/HierarchicalTestFrameworkContextResolver.cs @@ -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(); diff --git a/Telerik.JustMock/DebugView.cs b/Telerik.JustMock/DebugView.cs index dfd820f..f7268af 100644 --- a/Telerik.JustMock/DebugView.cs +++ b/Telerik.JustMock/DebugView.cs @@ -182,6 +182,8 @@ namespace Telerik.JustMock DynamicProxyMockFactory.SaveAssembly(); } #endif + + internal static Action DebugTrace = s => System.Diagnostics.Trace.WriteLine(s); } }