Microsoft Fakes is a relatively new framework, and I am also relatively new to ALL aspects of this question, so I need detailed answers as such.
I have been given the task of "Unit Testing" an application, we'll call it a Legacy Application, (by Michael Feathers definition) particularly with the Microsoft Fakes framework. The reason for my managers suggesting Fakes is it's ability to allow unit testing around external dependencies and APIs, specifically to remove database dependency.
Given that I have a weak background in VB.net, the .NET framework in general, and Unit testing in general, this task is somewhat overwhelming. Irregardless, I would like insight on using SHIMS to detour some of these internal class dependencies. The reason I am interested in SHIMS vs the faster and more easily implemented STUBS is because there are no Interfaces in this application (something else I am relatively unfamiliar with.) and interface is required for a STUB.
Now, for a more specific question given this background, I would like help with trying to unit test a class, say class Person who consists of "string Name" and type "Address address" and uses these as constructor parameters. Then, we may have that class Address is constructed with parameters "string streetNumber, "string street", and a user type "state State" with its own parameters...
public class Person()
Private mName As String
Private mAddr As myclass.Address
Public Sub New(ByVal name As string, ByVal addr As Address)
mName = name
mAddr = addr
End Sub
And elsewhere...
public class Address()
Private mStreet As String
Private mState As myclass.State
Public Sub New(ByVal street As String, ByVal state As State)
mStreet = street
mState = state
End Sub
And then there would be the state with whatever properties and methods it contains....
So, I would like to know how to build a unit test to isolate class Person from these other classes,(Address then State) so that if they are under dev or changed, the unit test for Person will still Pass... any suggestions???