Created
July 15, 2010 21:25
-
-
Save AlexZeitler/477556 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Concern | |
protected override void Because() { | |
_actualDependencyModel = Sut.Resolve(); // "root" of AssemblyHasTwoPartDependencies / EstablishContext should be passed to Resolve | |
} | |
// Dependency | |
public class AssemblyHasTwoPartDependencies : IBehaviorConfig { | |
public void EstablishContext(IDependencyAccessor accessor) { | |
IConfiguration activeRootConfiguration = accessor.An<IConfiguration>(); | |
IModelDoc2 root = accessor.An<IModelDoc2>(); | |
IComponent2 rootComponent = accessor.An<IComponent2>(); | |
root.WhenToldTo(m => m.GetActiveConfiguration()).Return(activeRootConfiguration); | |
activeRootConfiguration.WhenToldTo(c => c.GetRootComponent()).Return(rootComponent); | |
IComponent2 firstChildComponent = accessor.An<IComponent2>(); | |
IComponent2 secondChildComponent = accessor.An<IComponent2>(); | |
IModelDoc2 firstChildModelDoc = accessor.An<IModelDoc2>(); | |
IModelDoc2 secondChildModelDoc = accessor.An<IModelDoc2>(); | |
firstChildComponent.WhenToldTo(c => c.GetModelDoc2()).Return(firstChildModelDoc); | |
secondChildComponent.WhenToldTo(c => c.GetModelDoc2()).Return(secondChildModelDoc); | |
rootComponent.WhenToldTo(c => c.GetChildren()).Return(new[] { firstChildComponent, secondChildComponent }); | |
accessor.Use(root); | |
} | |
public void PrepareSut(object sut) { | |
} | |
public void Cleanup(object sut) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment