In your sample code, why do you have a RemoveAt(T obj) method?
Instead, you can do RemoveAt(int index) and Remove(T obj) . Take a look at the Microsoft APIs (for example, for List <T> ), which see how they set the removal methods for the general collection.
And now for your purposes:
1: What would Add(int number) do? If I understand your intentions correctly, Add(10) can only be indexed as "Add a value of 10 at the end of my collection." If you want to add a value to a specific index, you can (and probably should) call this method Insert: Insert(int index, T value) .
2: of course, Visual Studio will first interpret the method as void, but you can edit it as something like
public class MyStack<T> { public T Pop() { } }
Pins created by pressing Ctrl+. are convenience, but not the gospel. You should not always assign the return value to a variable. If you do not need it in the test, do not do it. If you want VS to choose a return type other than void, you can write a different unit test (for example, that Pop () returns the last value clicked).
3: I would test the types that I see most commonly used in my code. If you are writing a public API, then check as many types as possible. If you are using NUnit, examine the [TestCase] attribute to avoid code duplication.
4: I still use TestDriven, but I have not tried working without it, so I cannot make a useful comparison.
5: Just uninstall the installer if you do not need it. Some add-ons such as ReSharper support more advanced code generation, including read-only properties.
Adam learning
source share