I have the following code
public class MyCollection<T>
{
public void Add(T obj) { ... }
public int Count { get; }
}
and the following unit test to check whether Add increases the Count property by one:
[Fact]
public void Add_ShouldIncreaseCount()
{
var collection = new MyCollection<int>();
var oldCount = collection.Count;
collection.Add(default);
Assert.Equal(collection.Count, oldCount + 1);
}
However, I feel like the test is not "good" as in it only shows that Add works for MyCollection<int>.
Do I have to add tests for more value types and also reference types (e.g. string etc.) or is there a way (such as AutoFixture's fixture.Create<T>() to create arbitrary values) to create a "dummy" type?
Is there a way to indicate that I do not care about the actual generic type? What are the best practices in this case?