autofixture Questions

1

Solved

Is it possible to reuse production IoC container registration in integration tests when using AutoFixture? The problem is that I need the following fixture setup to inject mocks if dependency is n...
Salamone asked 31/7, 2015 at 7:7

2

Solved

I am using AutoMoq but I am kinda confused how to write my first unit test because of Entity Framework's (using EF6 and code first) dbContext // in service class(constructor) private readonly MyCo...
Kono asked 11/10, 2013 at 22:27

1

I've just installed VS2015, which at the same time installed .NET Framework 4.6, and suddenly AutoFixture 3.30.8 is unable to create a Claim object. I'm guessing having the new .NET Framework versi...
Overcome asked 21/7, 2015 at 8:16

2

Solved

So I have the following types: public abstract class Base { public string Text { get; set; } public abstract int Value { get; set; } } public class BaseImplA : Base { public override int Val...
Trichloroethylene asked 4/5, 2014 at 21:56

3

I was hoping that by using AutoFixture and NSubstitue, I could use the best of what each have to provide. I have had some success using NSubstitute on its own, but I am completely confused on how t...
Plaza asked 12/6, 2015 at 21:14

2

Solved

I'm using AutoFixture in my unit and integration tests and ran into a problem. I'm generating data transfer objects and some of those classes have DataAnnotation attributes (some of which are custo...
Purplish asked 5/8, 2014 at 20:26

1

Is there any way in AutoFixture so that fixture.Create<string>() will yield the same result? I.e., can I initialize the fixture with a seed? Update To be more precise, I'm looking for a ran...
Wherry asked 6/5, 2015 at 13:41

2

Solved

I've been using Moq for a while, and for brevity I more often than not express setups using the fluent syntax of Mock.Of... var foo = Mock.Of<IFoo>(f => f.Method(It.IsAny<string>())...
Betroth asked 23/4, 2015 at 0:26

3

Solved

I have found a solution that works (using DTOs and AutoMapper), which is reproduced below, but I would prefer an answer that lists the different approaches to the problem with examples and this wil...
Combustor asked 7/11, 2013 at 15:56

3

Solved

I am using the [AutoNSubstituteData] attribute, which was posted here: AutoFixture, xUnit.net, and Auto Mocking I would like to combine this with the [PropertyData("")] attribute from xunit exten...
Mireille asked 10/4, 2014 at 10:10

3

Solved

I'm trying to create AutoPropertyDataAttribute based on CompositeDataAttribute from this example AutoFixture: PropertyData and heterogeneous parameters. It works with single set of parameters, but...
Target asked 17/9, 2013 at 14:27

3

Solved

I'm currently having a model class which contains several properties. A simplified model could look like this: public class SomeClass { public DateTime ValidFrom { get; set; } public DateTime Ex...
Unsuccess asked 19/2, 2015 at 10:21

1

Solved

What does the CreateMany overload with the T seed parameter actually do? I've tried to seed, but the seed seems to have no effect on the created objects. For example, I was expecting that if my see...
Cirrostratus asked 11/2, 2015 at 19:32

1

Solved

Is there some easy way in Autofixture to new-up an object using it's constructor, but hard-code/specify the value to use for a single parameter in the constructor? I see that this can be done with...
Dormie asked 5/2, 2015 at 17:13

2

Solved

Is sharing the instance of Fixture across multiple test methods a good practice? Or is it better to create a new instance of Fixture for every test method? What is the best practice? It will be g...
Bouncer asked 19/1, 2015 at 1:55

3

Solved

Is it possible to assign a fixed value to a property on a child instance when building a parent with Autofixture? It will add default values to all the properties on the child instance like a charm...
Yama asked 7/1, 2015 at 8:33

3

Solved

I'm reading a lot of documentation and examples about how to properly unit test things combining the three components in the title. I came up with a test method for a method on my business logic, b...
Caracaraballo asked 18/12, 2014 at 9:35

2

Solved

I have a deeply-nested object model, where some classes might look a bit like this: class TBase { ... } class TDerived : TBase { ... } class Container { ICollection<TBase> instances; ......
Kokoschka asked 2/12, 2014 at 10:29

2

Solved

For those who are not sure what is meant by 'constrained non-determinism' I recommend Mark Seeman's post. The essence of the idea is the test having deterministic values only for data affecting SU...
Nun asked 25/10, 2014 at 12:52

2

Currently I'm using EF6 to implement my repositories inside a UnitOfWork. I also have created an In-Memory mock implementations (MockUnitOfWork & MockRepository) so that I can use them in unit ...
Gree asked 12/3, 2014 at 4:53

2

Solved

I'm using AutoFixture and I'd like to use a specific constructor. I have the following code and I like to select the constructor with ITemplateParameterHandler. public sealed class TemplateSegmen...
Anglican asked 16/9, 2014 at 13:52

3

I have the following type hierarchy: public abstract class ResourceId { } public class CarId : ResourceId { } public class PlaneId: ResourceId { } public interface IResource { ResourceId Id { ...
Toscano asked 26/8, 2014 at 5:38

2

Solved

I'm trying to write this simple test: var fixture = new Fixture().Customize(new AutoMoqCustomization()); var postProcessingAction = fixture.Freeze<Mock<IPostProcessingAction>>(); var ...
Canteen asked 5/2, 2013 at 13:47

3

Solved

I encountered a class during my work that looks like this: public class MyObject { public int? A {get; set;} public int? B {get; set;} public int? C {get; set;} public virtual int? GetSomeValu...
Malatya asked 18/2, 2012 at 13:3

3

Solved

I've recently started using AutoFixture+AutoMoq and I'm trying to create an instance of Func<IDbConnection> (i.e., a connection factory). var fixture = new Fixture().Customize(new AutoMoqCus...
Eighth asked 31/7, 2014 at 9:42

© 2022 - 2024 — McMap. All rights reserved.