Skip to content

Commit

Permalink
refactor!: Rename enum member to BasePosition for better reflect its …
Browse files Browse the repository at this point in the history
…purpose (#106)
  • Loading branch information
MrDave1999 authored Sep 22, 2024
1 parent bd1b0fd commit ccdfb26
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Application/Teams/Flags/Events/OnFlagAtBasePosition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// </summary>
public class OnFlagAtBasePosition : IFlagEvent
{
public FlagStatus FlagStatus => FlagStatus.InitialPosition;
public FlagStatus FlagStatus => FlagStatus.BasePosition;

public void Handle(Team team, Player player)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Application/Teams/Flags/FlagStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
public enum FlagStatus
{
/// <summary>
/// Indicates that the flag is on its base.
/// Indicates that the flag is at the base position, where it is defended to prevent enemy capture.
/// </summary>
InitialPosition,
BasePosition,

/// <summary>
/// Indicates that a player has captured the opposing team's flag from their base.
Expand Down
4 changes: 2 additions & 2 deletions src/Application/Teams/Team.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public virtual FlagStatus GetFlagStatus(Player flagPicker)
return FlagStatus.Brought;
}

return FlagStatus.InitialPosition;
return FlagStatus.BasePosition;
}

if (flagPicker.Team == (int)Id)
Expand All @@ -143,7 +143,7 @@ private class NoTeam : Team
{
public NoTeam() { }
public override string GetAvailabilityMessage(bool entireMessage = true) => string.Empty;
public override FlagStatus GetFlagStatus(Player flagPicker) => FlagStatus.InitialPosition;
public override FlagStatus GetFlagStatus(Player flagPicker) => FlagStatus.BasePosition;
public override string GetMembersAsText() => string.Empty;
public override string GetScoreAsText() => string.Empty;
public override bool IsFull() => false;
Expand Down
8 changes: 4 additions & 4 deletions tests/Application.Tests/Teams/GetFlagStatusTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public void GetFlagStatus_WhenPlayerFromBetaTeamBroughtTheFlagOfTheAlphaTeamToTh
}

[Test]
public void GetFlagStatus_WhenPlayerFromAlphaTeamAttemptsToCaptureTheFlagOfTheirTeamFromBase_ShouldReturnsInitialPositionStatus()
public void GetFlagStatus_WhenPlayerFromAlphaTeamAttemptsToCaptureTheFlagOfTheirTeamFromBase_ShouldReturnsBasePositionStatus()
{
// Arrange
Team alphaTeam = Team.Alpha;
var alphaTeamPlayer = new FakePlayer(id: 1, name: "Bob", team: alphaTeam.Id);
var expectedStatus = FlagStatus.InitialPosition;
var expectedStatus = FlagStatus.BasePosition;

// Act
FlagStatus actual = alphaTeam.GetFlagStatus(flagPicker: alphaTeamPlayer);
Expand All @@ -119,12 +119,12 @@ public void GetFlagStatus_WhenPlayerFromAlphaTeamAttemptsToCaptureTheFlagOfTheir
}

[Test]
public void GetFlagStatus_WhenPlayerFromBetaTeamAttemptsToCaptureTheFlagOfTheirTeamFromBase_ShouldReturnsInitialPositionStatus()
public void GetFlagStatus_WhenPlayerFromBetaTeamAttemptsToCaptureTheFlagOfTheirTeamFromBase_ShouldReturnsBasePositionStatus()
{
// Arrange
Team betaTeam = Team.Beta;
var betaTeamPlayer = new FakePlayer(id: 1, name: "Bob", team: betaTeam.Id);
var expectedStatus = FlagStatus.InitialPosition;
var expectedStatus = FlagStatus.BasePosition;

// Act
FlagStatus actual = betaTeam.GetFlagStatus(flagPicker: betaTeamPlayer);
Expand Down

0 comments on commit ccdfb26

Please sign in to comment.