This is a migrated thread and some comments may be shown as answers.

New to JustMock but can't get a simple example working

1 Answer 85 Views
JustMock Free Edition
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 21 Sep 2011, 08:25 PM
I am trying to get a very basic test working that looks like this and keep getting a failure.

Test:
[TestMethod()]
public void FooSubmitTest()
{
    Mock.SetupStatic<Foo>();
    Foo.Submit();
    Mock.Assert(() => Foo.Submit());
}

Submit method:
public class Foo
{
    public static void Submit()
    {
        throw new NotImplementedException();
    }

The test fails on this line:
throw new NotImplementedException();

Can you tell me why this does not pass?










1 Answer, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 27 Sep 2011, 12:03 PM
Hi Richard,

Thanks for sending the issue. However from your profile i can see that you are using JustMock free edition. Since mocking static method should be doing via profiler, therefore you should have JustMock Full / Trial installed and "Enable JustMock" in JM addin inside visual studio should be grayed out.

While I run your test with the latest release it seems to work as expected. You can also check if your profiler is up and running through this following line:

Assert.IsTrue(Mock.IsProfilerEnabled);


Hope that answers your question.

Kind Regards,
Mehfuz
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
JustMock Free Edition
Asked by
Richard
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Share this question
or