I just wanna ask what would be better approach to supply these objects in my unit tests.
In my unit test I am testing CSLA object. CSLA object is internally using one pr
Here is the code I use to return a test user (using Stubs):
[SetUp]
public void Setup()
{
var identity = MockRepository.GenerateStub();
identity.Stub(p => p.Name).Return("TestUser").Repeat.Any();
var principal = MockRepository.GenerateStub();
principal.Stub(p => p.Identity).Return(identity).Repeat.Any();
Thread.CurrentPrincipal = principal;
}
I've got linq in other code so I'm using the var type for the variables; just substitute the correct types (IPrincipal, IIdentity) if needed.