autofixture Questions

4

Solved

We have MVC4 project with Entity Framework for storage. For our tests we recently started using Autofixture and it is really awesome. Our models graph is very deep and usually creating one object ...
Zuckerman asked 29/3, 2013 at 15:1

2

Solved

I'm trying to create a simple way to test string parameters in unit tests, for most string parameters, I want to check the behaviour when the parameter is Null, Empty or consists only of whitespace...
Harmaning asked 15/12, 2015 at 8:45

2

The domain model I am working with has a lot of circular references. In fact it is possible to get to most objects from any point in the graph. Many of these circular references are also in collect...
Efrenefron asked 4/10, 2012 at 12:24

4

Solved

Is there an easy way to do this with AutoFixture? var myInt = fixture.Create<int>(min, max); I would like to know whether or not this is possible with AutoFixture or if I have to instantiate...
Cankerworm asked 25/11, 2016 at 19:8

3

Solved

To be succint: class AutoMoqDataAttribute : AutoDataAttribute { public AutoMoqDataAttribute() : base(new Fixture().Customize(new AutoMoqCustomization())) { } } public interface IWeapon { bool ...
Arv asked 17/7, 2014 at 7:45

4

Solved

In System.Collections.Generic there is a very useful ImmutableList. But for this type Autofixture is throwing an exception because it doesn't have public constructor, it's being created like new Li...
Leonteen asked 14/7, 2017 at 6:31

2

Solved

I'm getting exception on constructing DateOnly variables/fields with AutoFixture. (constructing of TimeOnly works fine) AutoFixture.ObjectCreationExceptionWithPath : AutoFixture was unable to crea...
Ballinger asked 15/9, 2022 at 13:38

3

Solved

How do I modify AutoFixture create method for float, double and decimal, so that when these types get created they will also have a remainder? Currently I do this, but this throws exception. var ...
Winebibber asked 16/7, 2013 at 9:31

2

Solved

I have a controller with the following signature: public CustomerTypeController( IHttpContextAccessor accessor, IPrincipalProvider provider, IMapper mapper, ILogger<CustomerTypeController&g...
Schuman asked 30/10, 2020 at 3:8

11

Solved

When using AutoFixture's Build method for some type, how can I limit the length of the strings generated to fill that object's string properties/fields?
Nari asked 12/4, 2012 at 14:4

5

Solved

I have the following types: public enum Status { Online, Offline } public class User { private readonly Status _status; public User(Status status) { _status = status; } public Status Status ...
Ruination asked 14/6, 2013 at 15:15

2

Solved

I'm new to xUnit.net and AutoFixture. I'm currently working on a "testproject" to get familiar with xUnit.net and Autofixture. There is one little thing I don't understand. What is the difference...
Angieangil asked 13/3, 2014 at 8:44

2

Is is possible to have ITestOutputHelper created by xUnit to be available in AutoFixture context? In my integration tests I use Builder class that contains helper methods for some routine operatio...
Refrigerator asked 11/2, 2017 at 21:38

2

Solved

I heavily use the Autofixture AutoData Theories for creating my data and mocks. However this prevents me from using the InlineData Attributes from XUnit to pipe in a bunch of different data for my ...
Fertilize asked 11/5, 2016 at 17:9

3

Solved

I'm writing some unit tests and have a class called Account which has public Guid AccountId {get;set;} public IEnumerable<string> EmailAddresses {get;set;} etc... I want to use autofixture...
Forland asked 1/4, 2016 at 20:17

4

Solved

I am using AutoFixture in this instance to materialize objects containing a Mongo ObjectId, like so Fixture fixture = new Fixture(); fixture.Register(ObjectId.GenerateNewId); But I am doing this...
Widower asked 8/9, 2015 at 9:24

2

Solved

I have the following class: class Foo { public Foo(string str, int i, bool b, DateTime d, string str2) { ..... } } I'm creating a Foo with AutoFixture: var foo = fixture.Create<Foo>()...
Disembodied asked 1/10, 2014 at 20:3

1

Solved

How to a specify a list/enumerable's length/size using an attribute on a property passed into a test using Autofixture's declarative parameter style? I want to be able to make this test pass withou...
Quincentenary asked 26/5, 2021 at 22:13

2

Solved

I'm using Autofixture to generate my test models but in one instance it says that my model has a circular reference which I cannot find. The failing model is the class RepresentationExpense and the...
Encamp asked 26/2, 2014 at 9:50

4

Solved

I use AutoData in my xUnit unit tests. I occasionally have a need for a particular number of objects to be supplied to my tests. Consider the following class: public class Recipient { public voi...
Dappled asked 17/1, 2014 at 21:6

3

Solved

Let's consider two version (one with read only properties) of the same very simple entity: public class Client { public Guid Id { get; set; } public string Name { get; set; } } vs public cl...
Hifi asked 20/11, 2017 at 11:53

3

Solved

How can I tell AutoFixture to specify a range (min and max) on some properties when doing MyDataClass obj = fixture.Create<MyDataClass>(); where MyDataClass has property Diameter and I only ...
Nickels asked 27/3, 2014 at 15:33

1

Solved

I have a controller with the following signature: public CustomerTypeController( IHttpContextAccessor accessor, IPrincipalProvider provider, IMapper mapper, ILogger<CustomerTypeController&g...
Chanukah asked 30/10, 2020 at 2:56

4

Solved

Actually, the following method always returns a positive integer: var fixture = new Fixture(); var someInt = fixture.Create<int>(); Is it possible that one day, the feature evolves and beg...
Galloway asked 14/7, 2015 at 13:8

2

Solved

I use NSubstitute a lot. And I love it. I am just looking into AutoFixture. It seems great! I have seen AutoFixture for NSubstitute and seen a few examples in Moq on how to use this feature. But...
Cereal asked 20/8, 2013 at 18:22

© 2022 - 2024 — McMap. All rights reserved.