Just need some clarification...
I am trying to use JustMock Debug View and it is not working. I am using NUnit. However, all of the examples online are using MSTest framework, so I am wondering if maybe the debug view is only supported in MSTest. The documentation does say that it only works with the [TestMethod] attribute. If that attribute is the trigger, then it seems reasonable that it may not work with [TestFixture] or [Test] attributes from Nunit.
3 Answers, 1 is accepted
The used testing framework does not influence the functionality provided by the DebugView. I have also tested your scenario by using NUnit and it works as expected. Please check the attached screenshot.
To further understand what is causing the problem could you provide more information Like:
1. How you enable the DebugView tracing?
2. What is your experience as a result of not working DebugView? Screenshots are highly appreciated.
Any additional information you think could help us reproduce the issue is welcome.
Regards,
Mihail
Progress Telerik

What I am doing is very similar to your screen shot. I have a NUnit test and I set a breakpoint in the test and execute debug. When it execution stops on the breakpoint, I open the watch window and type DebugView in the first column. The type ahead finds the telerik debug view namespace and I select it. But the value column displays an error. I leave it up and debug through each line of the unit tests and the watch value never changes.
Here's the code for my unit test. I also have an issue with the line 102... Mock.Arrange(() => database.Execute(null)).IgnoreInstance().MustBeCalled(); not working. So that might be related.
using
System.Collections.Generic;
using
System.Diagnostics.CodeAnalysis;
using
System.Web.Http.Results;
using
DHI.Common.Data.Cqrs;
using
DHI.SSNSearch.API;
using
DHI.SSNSearch.Data.Access;
using
NUnit.Framework;
using
Telerik.JustMock;
using
Assert = NUnit.Framework.Assert;
namespace
DHI.SsnSearch.Testing.UnitTests
{
[SuppressMessage(
"ReSharper"
,
"InconsistentNaming"
)]
[TestFixture]
public
class
SsnSearchControllerUnitTests
{
private
const
string
Ssn =
"000-11-1111"
;
private
const
string
LnKey =
"001120210"
;
private
static
SsnSearchController _sut;
private
static
IDatabase database;
public
class
SsnSearchControllerBaseTests
{
[Test]
public
void
SsnSearchController_ConstructorShouldNotErr()
{
Mock.Assert(_sut);
}
[Test]
public
void
SsnSearchController_DatabaseExecuteCalledWithoutErring()
{
Mock.Assert(database);
}
}
[TestFixture]
public
sealed
class
SsnSearchController_Constructor_Tests : SsnSearchControllerBaseTests
{
public
SsnSearchController_Constructor_Tests()
{
var database = Mock.Create<Database>();
_sut =
new
SsnSearchController(database);
Mock.Arrange(() =>
new
SsnSearchController(database));
}
}
[TestFixture]
public
sealed
class
SsnSearch_GetLoansBySsn_Tests : SsnSearchControllerBaseTests
{
private
readonly
OkNegotiatedContentResult<IEnumerable<SsnSearchResult>> _result;
public
SsnSearch_GetLoansBySsn_Tests()
{
database = Mock.Create<Database>();
Mock.Arrange(() => database.Execute(
new
GetLoansBySsn(Ssn)));
_sut = Mock.Create<SsnSearchController>(database);
Mock.Arrange(() => _sut.GetLoansBySsn(Ssn));
var response = _sut.GetLoansBySsn(Ssn);
_result = response
as
OkNegotiatedContentResult<IEnumerable<SsnSearchResult>>;
}
[Test]
public
void
SsnSearch_GetLoansBySsnMustBeCalled()
{
Mock.Assert(() => _sut.GetLoansBySsn(Ssn), Occurs.Once());
}
//[Test]
//public void SsnSearch_DatabaseExecuteMustBeCalled()
//{
// Mock.Assert(() => database.Execute(new GetLoansBySsn(Ssn)), Occurs.Once());
//}
[Test]
public
void
SsnSearchController_ResultShouldBeNull()
{
Assert.IsNull(_result);
}
}
[TestFixture]
public
sealed
class
SsnSearch_GetLoansByLnKey_Tests : SsnSearchControllerBaseTests
{
private
readonly
OkNegotiatedContentResult<IEnumerable<SsnSearchResult>> _result;
public
SsnSearch_GetLoansByLnKey_Tests()
{
database = Mock.Create<Database>();
_sut =
new
SsnSearchController(database);
Mock.Arrange(() => _sut.GetLoansByLnKey(LnKey)).IgnoreInstance().MustBeCalled();
Mock.Arrange(() => database.Execute(
null
)).IgnoreInstance().MustBeCalled();
var response = _sut.GetLoansByLnKey(LnKey);
_result = response
as
OkNegotiatedContentResult<IEnumerable<SsnSearchResult>>;
}
[Test]
public
void
SsnSearch_GetLoansByLnKey_ResultShouldBeNull()
{
Assert.IsNull(_result);
}
}
}
}
This is indeed a very strange behavior because when you access a property of the DebugView it is shown as expected. This can be seen from the screenshot in my previous post where I have added DebugView.CurrentState to the Watch window.
I have also tested with a simple static class defined in the test class and the result is the same.
public
static
class
Foo
{
public
static
bool
IsEnabled {
get
;
set
; }
}
My guess is that this is a problem of how Visual Studio handles static types in the Watch window.
Regarding the problem you mentioned on line 102, could you open a support ticket with more details on what exactly is not working?
Regards,
Mihail
Progress Telerik