Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Sep 5, 2024
1 parent 81a6413 commit 2ad36af
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 28 deletions.
1 change: 0 additions & 1 deletion GangsAPI/Data/Gang/IGang.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections;
using GangsAPI.Data.Stat;
using GangsAPI.Permissions;

namespace GangsAPI.Data.Gang;
Expand Down
3 changes: 1 addition & 2 deletions GangsAPI/Data/Gang/IGangPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using GangsAPI.Data.Stat;
using GangsAPI.Permissions;
using GangsAPI.Permissions;

namespace GangsAPI.Data.Gang;

Expand Down
2 changes: 1 addition & 1 deletion GangsAPI/Services/IStatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface IStatManager : IPluginBehavior, ICacher {
/// <param name="id"></param>
/// <returns></returns>
Task<IStat?> GetStat(string id);

/// <summary>
/// Creates a statistic with the manager, but does not register it.
/// If the statistic already exists with the same ID,
Expand Down
5 changes: 3 additions & 2 deletions GangsImpl/Mock/MockGang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ public MockGang(int id, string name, ulong owner) {
Ranks.Add(ownerRank);
}

public ISet<IStat> Perks { get; protected init; }
public ISet<IStat> Stats { get; protected init; }

public int GangId { get; protected init; }
public string Name { get; set; }
public IDictionary<ulong, IGangRank> Members { get; protected init; }
public ISet<IGangRank> Ranks { get; protected init; }
public ISet<IStat> Perks { get; protected init; }
public ISet<IStat> Stats { get; protected init; }

public object Clone() {
var clone = new MockGang(GangId, Name, ((IGang)this).Owner);
Expand Down
4 changes: 2 additions & 2 deletions GangsImpl/Mock/MockPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace Mock;

public class MockPlayer(ulong steam) : IGangPlayer {
public ISet<IStat> Stats { get; } = new HashSet<IStat>();
public ISet<IStat> Perks { get; } = new HashSet<IStat>();
public ulong Steam { get; } = steam;
public string? Name { get; }
public int? GangId { get; }
public IGangRank? Rank { get; }
public ISet<IStat> Stats { get; } = new HashSet<IStat>();
public ISet<IStat> Perks { get; } = new HashSet<IStat>();
}
8 changes: 4 additions & 4 deletions GangsImpl/Mock/MockStat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ namespace Mock;

public class MockStat(string statId, string name, string? desc = null)
: IStat, IEquatable<MockStat> {
public string StatId { get; } = statId;
public string Name { get; } = name;
public string? Description { get; } = desc;

public bool Equals(MockStat? other) {
return other is not null && ((IStat)this).Equals(other);
}

public string StatId { get; } = statId;
public string Name { get; } = name;
public string? Description { get; } = desc;

public override bool Equals(object? obj) { return Equals(obj as MockStat); }

public override int GetHashCode() { return HashCode.Combine(StatId); }
Expand Down
2 changes: 1 addition & 1 deletion GangsImpl/Stats/Stats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\GangsAPI\GangsAPI.csproj" />
<ProjectReference Include="..\..\GangsAPI\GangsAPI.csproj"/>
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion GangsTest/GangTests/GangCreationTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using GangsAPI.Data.Gang;
using GangsAPI.Services;
using Mock;

namespace GangsTest.GangTests;

Expand Down
6 changes: 3 additions & 3 deletions GangsTest/GangsTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
<ProjectReference Include="..\GangsImpl\Mock\Mock.csproj"/>
<ProjectReference Include="..\GangsImpl\SQLite\SQLite.csproj"/>
<ProjectReference Include="..\GangsImpl\SQL\SQL.csproj"/>
<ProjectReference Include="..\GangsImpl\Stats\Stats.csproj" />
<ProjectReference Include="..\GangsImpl\Stats\Stats.csproj"/>
<ProjectReference Include="..\Gangs\Gangs.csproj"/>
</ItemGroup>

<ItemGroup>
<Folder Include="StatTests\InstanceManageTests\GangManager\" />
<Folder Include="StatTests\InstanceManageTests\PlayerManager\" />
<Folder Include="StatTests\InstanceManageTests\GangManager\"/>
<Folder Include="StatTests\InstanceManageTests\PlayerManager\"/>
</ItemGroup>

</Project>
16 changes: 8 additions & 8 deletions GangsTest/StatTests/InstanceManageTests/InstanceGangTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
namespace GangsTest.StatTests.InstanceManageTests;

public class InstanceGangTests(IGangManager gangMgr) {
private class TestStatInstance : IStat<int> {
public string StatId => "test_stat";
public string Name => "Test Stat";
public string? Description => "A test stat.";
public int Value { get; set; } = 32;
}

private IGang testGang =
private readonly IGang testGang =
gangMgr.CreateGang("Test Gang", (ulong)new Random().NextInt64())
.GetAwaiter()
.GetResult() ?? throw new InvalidOperationException();
Expand Down Expand Up @@ -53,4 +46,11 @@ public async Task Instance_Fetch_Unregistered(IStatManager stat,
var result = await manager.GetForGang(testGang, testStat);
Assert.Null(result);
}

private class TestStatInstance : IStat<int> {
public string StatId => "test_stat";
public string Name => "Test Stat";
public string? Description => "A test stat.";
public int Value { get; set; } = 32;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace GangsTest.StatTests.InstanceManageTests;

public class InstanceManageData : IEnumerable<object[]> {
private object[][] behaviors;
private readonly object[][] behaviors;

public InstanceManageData() {
var inst = new MockStatManager();
Expand Down
2 changes: 0 additions & 2 deletions GangsTest/StatTests/StatInstanceEqualityTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using GangsAPI.Services;
using GangsTest.StatTests.ManageTests;
using Mock;

namespace GangsTest.StatTests;
Expand Down

0 comments on commit 2ad36af

Please sign in to comment.