You could include application B as a reference in application A, and then use Mocking frameworks to change the behaviour of B's methods or properties when calling it's API directly. This is the same process used for unit tests when setting up expectations on dependencies. There are limitations that generally this only works if the object in question is an interface, or contains vi
rtual (overridable) methods/properties. The solution may also be dependent on being able inject a dependency into Bs API, which may or may not be possible depending on the scenario.
Moq, Rhino Mocks. and TypeMock all provide this functionality. Here's a quick example of Moq to override the behaviour of a GetPath method with an alternative value:
// create a mocked version of a class and setup an expectation
var appBClassMoq = new Mock<AppBClass>();
appBClassMoq.SetUp(o => o.GetPath()).Returns("C:\MyNewPath");
// get the mocked instance
var appBClass = appBClassMoq.Object;
// run some code, when it hits GetPath() it will return the mock value
appBClass.SomeMethodThatCallsGetPath();