Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autofixture: Controlling number of elements that are created of type string[]

Tags:

c#

autofixture

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 also looked into using CreateMany but that seemed to return a type of IEnumerable.

Anyone have any ideas ?

like image 222
Martin Avatar asked Jul 01 '14 09:07

Martin


1 Answers

Use the RepeatCount property:

var fixture = new Fixture { RepeatCount = 9 }; var actual = fixture.Create<string[]>(); // -> The 'actual' array is 9 items now. 

or

fixture.CreateMany<string>(9).ToArray() 
like image 180
Nikos Baxevanis Avatar answered Sep 29 '22 20:09

Nikos Baxevanis