autofixture Questions

1

Solved

i have a simple Setup method in my tests thats creates two instances of an object (make by and Id and a Description properties) and i have done it with autofixture: MyObject o1 = fixture.Create&lt...
Delossantos asked 21/8, 2014 at 9:25

1

Solved

For a list, we can do fixture.CreateMany<List<string>>(1000); // with 1000 elements but how to do it with a dictionary? And to be able to specify the number of elements to be generated...
Bruton asked 19/7, 2014 at 18:6

1

Solved

I have an issue with creating a string array of type string[], everytime it creates 3 values but i want to be able to control this. I am using var tst = fixture.Create<string[]>(); I als...
Loudspeaker asked 1/7, 2014 at 9:47

1

Solved

Can I instruct AutoFixture to fill also private properties, annotated with a specific attribute such as Ninject.Inject, of all classes? The source seems to scan for public properties only: 1. This ...
Penneypenni asked 28/3, 2014 at 8:12

2

Solved

By default AutoFixture creates DateTime structs in "local, unspecified time". I have been trying to find a way to configure it to create DateTime structs with UTC kind, but so far unsuccessful. ...
Ovation asked 27/3, 2014 at 11:57

2

Solved

I want to write a test that checks classes within a given namespace. All methods of that classes that return any kind of list have to be checked, if they would return null. If so the test has to fa...
Update asked 25/10, 2013 at 9:16

1

Solved

Assume I have this concrete class: public partial class User { public int ID { get; set; } public string Email { get; set; } public string FullName { get; set; } } And I want to create an ano...
Steamy asked 11/3, 2014 at 17:11

2

Solved

I want to create "many" instances of foo : var fixture = new Fixture(); var expectedFoos = fixture.CreateMany<Foo>(); The problem is, Foo is an Entity Framework entity, with relations that...
Salamone asked 7/3, 2014 at 23:46

1

Solved

We have an enum: enum Letters { A, B, C, D, E } When I try: var frozenLetter = fixture.Freeze(Letters.D); Strangely, frozenLetter == A. var letter = fixture.Create<Letters>(); va...
Galegalea asked 6/2, 2014 at 18:31

1

Solved

I don't really grasp the difference between Customizations and Residue Collectors. According to Documentation, if I register a customization that can build, ExampleClass it will handle requests fo...
Dawndawna asked 5/2, 2014 at 23:2

2

Solved

I'm using AutoFixture, Moq, and XUnit extensions ([Theory] attribute) as described in this blog post http://blog.ploeh.dk/2010/10/08/AutoDataTheorieswithAutoFixture. I've noticed that most of unit...
Seringapatam asked 6/1, 2014 at 17:33

1

Solved

Let's say we have an enum type defined as: enum Statuses { Completed, Pending, NotStarted, Started } I'd like to make Autofixture create a value for me other than e.g. Pending. So (assuming...
Mccarty asked 6/1, 2014 at 18:46

1

Solved

I have a set of working imperative code in test and I'm trying to boil it down to an essential test convention. My test looks like the following: [Theory, BasicConventions] public void GetVersion...
Threonine asked 20/12, 2013 at 22:7

2

Solved

I have the following two classes: public class KeyedEntity<TEntity> { internal KeyedEntity() { } public Identifier Key { get; set; } public TEntity Entity { get; set; } } public static ...
Huntlee asked 26/11, 2013 at 5:50

1

Solved

Is there some kind of way to let AutoFixture create properties with an internal setter? I've looked at the AutoFixture source and found that in the AutoPropertiesCommand the GetProperties method ch...
Airboat asked 13/10, 2013 at 12:45

1

Solved

I want to create a list of custom objects using AutoFixture. I want the first N objects to have a property set to one value, and the remainder to have it set to another value (or to simply be set b...
Strahan asked 10/10, 2013 at 3:17

2

Solved

I installed Autofixture and Moq using Nuget.So I have moq version 4. When running the following code var fixture = new Fixture().Customize(new AutoMoqCustomization()); fixture.CreateAnonymous&lt...
Mantooth asked 28/6, 2011 at 11:19

1

Solved

I can get type of constructor parameter like this: Type type = paramInfo.ParameterType; Now I want to create stub object from this type. Is is possible? I tried with autofixture: public TObject...
Worden asked 23/9, 2013 at 7:20

1

Solved

I am using AutoMoqCustomization in my test conventions. Consider the code below. Everything works great until I add a constructor to one of the concrete classes. When I do, I get "could not find a...
Isatin asked 28/8, 2013 at 20:22

2

Solved

I have a set of Data Access classes that are nested fairly deep. To construct a list of 5 of them takes AutoFixture more than 2 minutes. 2 minutes per Unit test is way to long. If I was coding th...
Maecenas asked 20/8, 2013 at 23:57

1

Solved

Please note, I'm somewhat new to TDD, so I will take general advice as well as specific answer. Neither abstract classes nor interfaces can be instantiated. Clearly Moq can give me a mocked up ins...
Raspy asked 14/12, 2012 at 20:43

1

Solved

Consider the following test, [Theory, MyConventions] public void GetClientExtensionReturnsCorrectValue(BuilderStrategy sut) { var expected = ""; // <--??? the value injected into BuilderStrat...
Plataea asked 14/8, 2013 at 17:27

3

Solved

Using AutoFixture as a SutFactory, I can see that if I register or freeze a value for a type, that value will then be used for all subsequent usages of that type. However, if I have a class with tw...
Compony asked 8/6, 2013 at 8:47

3

Solved

Before starting, I'm a big fan of AutoFixture, I'm still in the curve of learning how to use the tool. So thanks for having developed Autofixture Mr Ploeh and all the contributors. So let's start ...
Brainless asked 10/8, 2013 at 10:47

1

Solved

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...

© 2022 - 2024 — McMap. All rights reserved.