I am using AutoFixture in my unit test, to simplify my test setup. Sometimes I have the use case that I need a list with one specific object.
var inputValues = AutoFixture.Build<TestObject>().CreateMany().ToList();
inputValues[0] = new TestObject { name = "best guy"}
Currently I solve this my issue with the code snipping below. I am sure there is a better solution.
I find this post Create a list with specific values with Autofixture C# but I am really happy this such solution.
I am also aware of something like this:
var inputValues = AutoFixture.Build<TestObject>().With(c => c.Name = "test" ).CreateMany().ToList();
But this will set all list entries with the same value.