I have a method that looks something like this
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("someName", this.someName);
info.AddValue("someName1", this.someName1);
base.GetObjectData(info, context);
}
If I'm unit testing this method, should I just leave it as it is or should I try and test 'base.GetObjectData()' by iteself by refactoring it out somehow?
How would I unit test this method?
I included a statement that now checks to see if a parameter in null.
if (info == null)
{
throw new ArgumentNullException("info");
}
and I included a test like so
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void GetObjectData_NullParameters_ThrowsException()
{
Respondent myRespondent = new Respondent(new RespondentInformation());
SerializationInfo info = null;
StreamingContext context = new StreamingContext();
myRespondent.GetObjectData(info, context);
}
but isn't there more to test? What else can I test? Shouldn't I be testing the base.GetObjectData' method?