A mocking framework, used in unit tests for injecting "fake" implementations of interfaces as dependencies of the system under test. Use this tag for code reviews of unit testing methods that use this specific mocking framework.
1
vote
1answer
85 views
REST API wrapper testing
I'm writing wrapper for REST API of a service. In my wrapper I have quite simple method:
...
2
votes
1answer
100 views
Unit testing a prism event
I am currently working on a C# WPF project following the MVVM design pattern. I am using Autofac and Prism as core frameworks in the design. For unit testing I am using Xunit and Moq. I am also using ...
5
votes
1answer
92 views
UnitTesting with Mocking and Dependency Injection using Ninject
I have the following scenario that I have not come across so far using Ninject. I have the following class structure (simplified for easy of reading :]). First the abstract base class for all ...
3
votes
1answer
296 views
Unit test with Moq callback anonymous function
I have the following unit test that is testing predicate logic in a repository (Note: mockOpportunityRepository.Setup):
...
5
votes
1answer
1k views
Service-Repository pattern with IoC, NPoco micro-ORM and unit tests
I'm trying to build a Web API using best practices, based on a simple proof-of-concept using students.
My goal is to build the system using:
Onion Architecture to seperate concerns.
Service-...
2
votes
1answer
147 views
Mocking IElasticClient in unit tests
I'm trying to unit test how my class responds to a NEST 1.7 IElasticClient's return values, using NUnit 2.6.4 and Moq 4.2. I feel mocking the ...
6
votes
1answer
4k views
Unit testing with dependency injection and MOQ
I'm just learning how dependency injection and mocking work, but I'd like some feedback on how I'm setting up a couple of tests. I can get them to pass, but I'm not sure this is all I need.
This is ...
2
votes
1answer
2k views
Same setup for many properties in Moq
I'm trying to use Moq to mock a rather large set of interfaces in an object. I'm trying to capture the behavior of retaining a dirty flag when properties are set and I'm hoping there is a cleaner way ...
5
votes
2answers
2k views
Using the builder pattern to build mock objects and nested builders
No, this question has no roosting construction workers.
I'm not sure if what I'm doing is a good use of the builder pattern or whether its a bastardization of what its intended purpose was. I'm ...
6
votes
1answer
5k views
Unit tests using C#, Moq, AutoFixture, FluentAssertions
Could you give any suggestion on the following unit tests? How to make it more readable, maintainable and trustworthy. If it is not a problem - post some code with the suggestions.
...
2
votes
1answer
79 views
3
votes
2answers
331 views
Using MOQ in unit-testing for a shipping calculator
I am fairly new to writing unit tests, and I was wondering if this approach I have taken is on the right track?
Given the following interfaces/classes:
...
4
votes
2answers
9k views
REST Web Api unit test endpoint validity with NUnit and Moq
I am unit testing that the URL that I give to my IRestClient is valid. This client talks to a third party Web API.
The test is as below:
...
0
votes
1answer
285 views
Verify collection as a method parameter
How can I verify that ohterClassMock.MethodToTest() was called with contracts?
That it was called with ...
3
votes
1answer
344 views
14
votes
3answers
1k views
Unit tests for testing error codes
Both unit tests pass and they both test the same thing. The production code uses the right error codes.
System Under Test (SUT)
...
6
votes
2answers
1k views
Is this UnitTest for updating an object in data-access layer sensible?
I'm still trying to learn how to write good tests (and write testable code).
This is the function I want to verify,
...
7
votes
1answer
4k views
Unit tests for methods that access the file system
Basically I have some methods that access the file system and to avoid that in the unit test I have broken those sections out into a protected virtual method. In the Unit Test I then use Moq to setup ...
0
votes
1answer
8k views
Mocking the class under test with private method calls
Consider the scenario below. It covers multiple methods of my unit under test.
...