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

Profiler must be enabled to mock/assert

5 Answers 253 Views
JustMock Free Edition
This is a migrated thread and some comments may be shown as answers.
Ra
Top achievements
Rank 1
Ra asked on 05 Sep 2012, 04:18 PM
Hi,

I am getting Profiler must be enabled error on Mock.Arrange. I have the following code snippet.

[TestMethod]
        public void TestMethod2()
        {
            bool called = false;


            var bll = new FieldBLL();


            List<Field> fields = new List<Field>();
            fields.Add(new Field("custom100", "Bio", "Select"));


            Mock.Arrange(() => new FieldDAL().GetAllFields()).DoInstead(() => { called = true; })
                      .Returns(Fields);


            string name = bll.GetFirstFieldName();
            Assert.AreEqual(name, "custom100");
        }

Please let me know how I can fix this error.
thanks..

5 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 10 Sep 2012, 02:20 PM
Hi Rajyalakshmi,

 Thank you for contacting us.

 There are several reasons that can cause this error. One of the causes may be that your profiler is disabled. If so you will have to enable it from the Telerik menu in your Visual Studio. You will need to click on the JustMock menu, Enable JustMock. I have attached a screenshot to orient you better.

 However, if your profiler is enabled and the error is still occurring, you will have to send us an event log so we can continue with further investigation about your issue. You can copy the event log by following the next steps:
  1. Reproduce the error once again (by running your tests for example).
  2. After that click the Windows Start button and type "Event Viewer". Run the Event Viewer.
  3. At the Event Viewer main window you have to navigate to Windows Logs> Application.
  4. You can sort the events by date and search for the last one with event ID 1022. Open it and click copy .
  5. Send it to us.  

 Thank you for your cooperation in advance.

Kind regards,
Kaloyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ra
Top achievements
Rank 1
answered on 10 Sep 2012, 03:10 PM
Hi,

Thanks for your reply. This is JustMock Free Edition. I do not have Telerik Menu in Visual Studio. Was wondering why it is complaining that profiler needs to be enabled. Will the code that i posted work with Free Edition? If not, could you please suggest  what changes can be done to the code to work in Free Edition?


Thanks.


0
Kaloyan
Telerik team
answered on 11 Sep 2012, 07:58 AM
Hi Rajyalakshmi,

Thank you for contacting us again.

 In order to help you, I will suggest you to look at the link below. There you will find what is supported in JustMock Free Edition and for what you will be needing JustMock Commercial version:
 -http://www.telerik.com/help/justmock/getting-started-commercial-vs-free-version.html 

 For further assistance you can go through the Basic Usage examples in the help documentation as they are all fully supported by the JustMock Free Edition:
 -http://www.telerik.com/help/justmock/basic-usage.html 

 Do not hesitate to ask, if there is anything else i can help you with.

Regards,
Kaloyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Eloy
Top achievements
Rank 1
answered on 03 Apr 2013, 05:53 PM
I'm getting the same error with this code on the free edition
var rs = Mock.Create<Item>(Constructor.Mocked);
Mock.Arrange(() => rs.ID).Returns(new ID(new Guid()));

As I'm using the free edition I don't have the telrik menu on visual studio. How can I turn the profiler on?
I've been playing with the environment variables without luck (but wasting a lot of time on each computer reset)

Now setting a mock return property looks pretty basic to me and also I have to point out that "return" is on the free edition feature list.
My 5 cents: a free edition should be hassle free, otherwise no one is going to pay for the pro edition.
0
Kaloyan
Telerik team
answered on 04 Apr 2013, 12:20 PM
Hello Eloy,

By design JustMock Lite acts like the other free-of-charge mocking tools, for example MOQ.

You are correct that JustMock Lite has the "Return()" feature. However, it lacks the profiler, which is the main difference comparing it with the paid version. That's why with JustMock Lite you can't mock non-virtual, sealed or static functions.

In your example code, Item looks like a class. To mock its ID property, you can either declare it as virtual, or use the commercial edition of JustMock. More about this issue can be found here.

I hope this helps.

Greetings,
Kaloyan
the Telerik team
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Tags
JustMock Free Edition
Asked by
Ra
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Ra
Top achievements
Rank 1
Eloy
Top achievements
Rank 1
Share this question
or