diff options
| -rwxr-xr-x | src/core/RoboMom.cs | 30 | ||||
| -rwxr-xr-x | src/specs/Mock.cs | 12 | ||||
| -rwxr-xr-x | src/specs/RoboMomSpecs.cs | 9 | ||||
| -rwxr-xr-x | src/specs/specs.csproj | 1 |
4 files changed, 24 insertions, 28 deletions
diff --git a/src/core/RoboMom.cs b/src/core/RoboMom.cs index 50d577e..6a23a7d 100755 --- a/src/core/RoboMom.cs +++ b/src/core/RoboMom.cs @@ -13,11 +13,6 @@ namespace core public override void Run()
{
- while(true)
- {
- TurnLeft(10);
- Ahead(5);
- }
}
public override void OnBulletHit(BulletHitEvent evnt)
@@ -27,60 +22,57 @@ namespace core public override void OnBulletHitBullet(BulletHitBulletEvent evnt)
{
- base.OnBulletHitBullet(evnt);
+ publisher.Publish(evnt);
}
public override void OnBulletMissed(BulletMissedEvent evnt)
{
- base.OnBulletMissed(evnt);
+ publisher.Publish(evnt);
}
public override void OnDeath(DeathEvent evnt)
{
- base.OnDeath(evnt);
+ publisher.Publish(evnt);
}
public override void OnHitByBullet(HitByBulletEvent evnt)
{
- base.OnHitByBullet(evnt);
+ publisher.Publish(evnt);
}
public override void OnHitRobot(HitRobotEvent evnt)
{
- base.OnHitRobot(evnt);
+ publisher.Publish(evnt);
}
public override void OnHitWall(HitWallEvent evnt)
{
- base.OnHitWall(evnt);
- TurnRight(180);
+ publisher.Publish(evnt);
}
public override void OnRobotDeath(RobotDeathEvent evnt)
{
- base.OnRobotDeath(evnt);
+ publisher.Publish(evnt);
}
public override void OnScannedRobot(ScannedRobotEvent evnt)
{
- base.OnScannedRobot(evnt);
- TurnGunLeft(Heading - evnt.Bearing);
- Fire(10);
+ publisher.Publish(evnt);
}
public override void OnWin(WinEvent evnt)
{
- base.OnWin(evnt);
+ publisher.Publish(evnt);
}
public override void OnRoundEnded(RoundEndedEvent evnt)
{
- base.OnRoundEnded(evnt);
+ publisher.Publish(evnt);
}
public override void OnBattleEnded(BattleEndedEvent evnt)
{
- base.OnBattleEnded(evnt);
+ publisher.Publish(evnt);
}
public override bool IsAdjustGunForRobotTurn
diff --git a/src/specs/Mock.cs b/src/specs/Mock.cs new file mode 100755 index 0000000..cd59a6a --- /dev/null +++ b/src/specs/Mock.cs @@ -0,0 +1,12 @@ +using Rhino.Mocks;
+
+namespace specs
+{
+ public static class Mock
+ {
+ public static T An<T>() where T : class
+ {
+ return MockRepository.GenerateMock<T>();
+ }
+ }
+}
\ No newline at end of file diff --git a/src/specs/RoboMomSpecs.cs b/src/specs/RoboMomSpecs.cs index d20b81b..0869299 100755 --- a/src/specs/RoboMomSpecs.cs +++ b/src/specs/RoboMomSpecs.cs @@ -16,7 +16,6 @@ namespace specs static RoboMom sut;
static IPublishEvents publisher;
-
public class when_hit
{
It should_publish_the_event = () =>
@@ -37,12 +36,4 @@ namespace specs static BulletHitEvent message;
}
}
-
- public static class Mock
- {
- public static T An<T>() where T : class
- {
- return MockRepository.GenerateMock<T>();
- }
- }
}
\ No newline at end of file diff --git a/src/specs/specs.csproj b/src/specs/specs.csproj index 0d7bef0..c1a7786 100755 --- a/src/specs/specs.csproj +++ b/src/specs/specs.csproj @@ -53,6 +53,7 @@ </ItemGroup>
<ItemGroup>
<Compile Include="EventAggregatorSpec.cs" />
+ <Compile Include="Mock.cs" />
<Compile Include="RoboMomSpecs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
|
