Created
November 21, 2010 17:01
-
-
Save AlexZeitler/708903 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
public class LightSwitchedOff : IBehaviorConfig { | |
public void EstablishContext(IDependencyAccessor accessor) { | |
accessor.The<ILight>().WhenToldTo(l => l.LightState).Return(LightState.Off).Repeat.Once(); | |
accessor.The<ILight>().WhenToldTo | |
(l => l.SwitchLight(LightState.On)).Do( | |
new Func<object, LightSwitchedHandlerArgs, int>((sender1, args1) => | |
{ | |
accessor.The<ILight>() | |
.Event(l => l.LightSwitched += (sender, args) => { }) | |
.Raise(this, new { LightState.On }); | |
return 0; | |
})); | |
} | |
public void PrepareSut(object sut) { | |
} | |
public void Cleanup(object sut) { | |
} | |
} | |
Where: | |
public delegate void LightSwitchedHandler(object sender, LightSwitchedHandlerArgs args); | |
and: | |
public LightSwitchedHandlerArgs(LightState lightState) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment