I've just started to use AutoFixture.AutoMoq in my unit tests and I'm finding it very helpful for creating objects where I don't care about the specific value. After all, anonymous object creation is what it is all about.
What I'm struggling with…
The short takeaway now that the solution has been found:
AutoFixture returns frozen the mock just fine; my sut that was also generated by AutoFixture just had a public property with a local default that was important for the test and that…
I started to use moq but from my understanding I always have to mock up all the methods that could be called even if I really do not care about them.
Sometimes it takes so long to mockup stuff you forget what you want to do. So I been looking at…
When I use Moq directly to mock IBuilderFactory and instantiate BuilderService myself in a unit test, I can get a passing test which verifies that the Create() method of IBuilderFactory is called exactly once.
However, when I use Autofixture with…
I'm trying to set up a snapshot for a small react component but I keep getting the following error
TypeError: val.getMockName is not a function
it('renders correctly', () => {
const wrapper = renderer.create(
Given this system to test:
public class MySut
{
private readonly IHardToMockDependency _hardToMockDependency;
public MySut(IHardToMockDependency hardToMockDependency,
IOtherDependency otherDependency)
{
…
I use AutoFixture with AutoMoq. I try to create a fake instance of a class which has a property with a getter but without a setter. I expect AutoFixture to configure the mock so it will return the given value even there is no setter.
My code is…
We are using Autofac.Extras.Moq.AutoMock.
Now I have a constructor dependency using Lazy<>
public MyService(Lazy myLazyDependency) {...}
to test MyService we need to mock the Lazy.
I am trying this…
I've recently been working on a project that has started to get fairly dependency heavy and have been exploring the idea of using an AutoMocking container to clean up my tests a bit and make them less brittle.
I've heard arguments against using…
i wonder if it is possible to auto mock
a container in MOQ without any additions to the MOQ lib.
I am having problems finding a clean way to automock an IList.
Thanks in advance!
I have xUnit/Moq/AutoFixture successfully working together so that I am auto mocking objects via test method input parameters. I created a custom [AutoMoqData] attribute which I use on every test. Here's the code for the attribute:
using…
I am new to both libraries and before committing to their usage on a large project I need clarification on my options for low-code effort automocking in my unit tests.
After spending some time on Google I have concluded that, unlike some other…
I have a project which uses Qt5 and I have a CMakeLists.txt file that I use for creating the Visual Studio Solution.
This is an excerpt of my CMakeLists.txt
cmake_policy(SET CMP0020 NEW)
set(CMAKE_AUTOMOC ON)
find_package(Qt5 REQUIRED COMPONENTS…
I am want to do automocking with Windsor so that I can do something like
_controller = _autoMockingContainer.Create();
There used to be a Windsor auto mocking container in Ayende's Rhino libraries. But that…