public void UseFakeSecurityContext(FubuRegistry registry)
 {
     if (FakeSecurityContext == null) {
         FakeSecurityContext = new FakeSecurityContext();
     }
     registry.Services(serviceRegistry => serviceRegistry.ReplaceService<ISecurityContext>(FakeSecurityContext));
 }
        public override void Create()
        {
            //CThruEngine.AddAspect(new TraceAspect(info => info.MethodName == "CreateInstance"));
            //CThruEngine.StartListening();
            //var securityStub = Stub.For<ISecurityContext>("get_CurrentIdentity").Return(new GenericIdentity("name1"));

            FakeSecurityContext = new FakeSecurityContext {UserName = "******"};

            base.Create();

            if (Directory.Exists(RepositoryPath.ParentDirectory()) )
                DirectoryHelper.DeleteSubdirectories(RepositoryPath.ParentDirectory());
            Repository.Clone(REPO_URL, RepositoryPath);

            //now let's see what a different user has
            FakeSecurityContext.UserName = "******";
        }