Questions tagged [justmock]

JustMock is a mocking framework for unit testing .NET code. The product is developed by Telerik.

104 questions
0
votes
1 answer

How to properly unit test a class that takes a dependency using JustMock

I'm new to unit testing and would like to know how to properly mock out an interface using JustMock Lite. I have class that looks something like this : public class Person { public Person(IFileReader reader) { Parse(reader); } public…
poco
  • 2,935
  • 6
  • 37
  • 54
0
votes
1 answer

Preferring non-generic version of method over generic version in c#

I'm trying to stub an NHibernate ICriteria using JustMock. Specifically I'm trying to stub the List<> method when it is called with an array of object: var mockCriteria = Mock.Create(); Mock.Arrange(() =>…
Jeff Hornby
  • 12,948
  • 4
  • 40
  • 61
0
votes
1 answer

JustMock Syntax to Moq

I want to translate from JustMock syntax to MOQ : JustMock : Mock model = new Mock(); Mock.Arrange(() => model.Components).IgnoreInstance().ReturnsCollection(this.FakeComponent()); I try: model.Setup(x =>…
Thinh
  • 15
  • 3
0
votes
1 answer

mocking unit of work interface?

I m doing EF with repository and Unit of Work, and my controller has Unit of Work interface which I m instantiating in constructor. It was a little easy to mock while using repositories but I am really not getting how to mock UoW interface in test…
user576510
  • 5,777
  • 20
  • 81
  • 144
0
votes
3 answers

how to unit test a delete method using JustMock lite and MSTest?

I am just getting started with unit testing and now stuck writing a test method for delete. I am using MStest and JuckMock. I have my test method as follow. The idea is not to use real repository and use JustMock to mock one but in the code, i am…
Laurence
  • 7,633
  • 21
  • 78
  • 129
0
votes
2 answers

Mocking and unit test passes even though assertion is not correct

I'm very new to unit testing and TDD on a whole. I have the following Login method in my Service layer (WCF) which is hosted as a windows service. My service layer follows the facade pattern, and all calls to the service layer are made with requests…
Null Reference
  • 11,260
  • 40
  • 107
  • 184
0
votes
1 answer

Why is JustMock claiming my mocked method is never getting called?

I have the following code in my application: public class DirectoryCrawler { private IPathWrap _path; private IDirectoryWrap _directory; private ITrackedFileStore _trackedFileStore; private IFileWrap _file; public…
KallDrexx
  • 27,229
  • 33
  • 143
  • 254
0
votes
1 answer

What is equivalent of moq.As in JustMock?

I am stuck to mock Entity Framework 6 asynchronous methods using JustMock. I searched in Google a lot but did not get any sufficient result. At last I got an example at testing with async queries but it is used Moq. I am try to convert this into…
Hasanuzzaman
  • 1,822
  • 5
  • 36
  • 54
0
votes
1 answer

The following setups were not matched - converting JustMock to Moq

I am going through this tutorial http://blogs.telerik.com/justteam/posts/13-10-25/30-days-of-tdd-day-17-specifying-order-of-execution-in-mocks in regards to TDD. I am attempting to adapt a JustMock statement to Moq. enter code here [Test] …
derguy
  • 3
  • 2
  • 3
0
votes
2 answers

NullReferenceException when trying to Enumerate via Mock

I'm getting an odd NullReferenceException that I can't understand when trying to mock up a collection to enumerate. I don't think it's anything caused by Mock but I'm not 100% sure. Can anyone identify anything silly that I'm…
Ian
  • 33,605
  • 26
  • 118
  • 198
0
votes
1 answer

Exception trying to mock SharePoint 2010 UserProfileManager with JustMock

I'm trying to create a mock version of UserProfileManager in order to effectively unit test a Sharepoint 2010 Web Part Every time I run this code, I get the the exception being thrown below. I've verified that the feature works when I debug the code…
0
votes
1 answer

Telerik JustMock throws exception when trying to mock SPServiceContext

I'm trying to write some unit tests for a Sharepoint 2010 Webpart that uses UserProfile manager. In order to mock UserProfileManager, I also need to mock SPServiceContext. When I try to assign my mock variable, like this: _mockServiceContext =…
-1
votes
2 answers

Unit test: wait all threads completion before asserting

Inside a test I am creating multiple threads, to test racing conditions, I need the threads start at the same time, so far so good. But when I assert the number of times the method has been executed, if fails because it is not waiting until all the…
DanielV
  • 2,076
  • 2
  • 40
  • 61
-3
votes
1 answer

it is correct to use setup in unit test C#

I am explaining better, I am studying how to do unit tests in C # with NUnit and justmock. I am reading the book the art of unit tests, Here I am told that whenever possible try to avoid [SetUp] for a previous scenario configuration a try. But…
Johan
  • 60
  • 8
1 2 3 4 5 6
7