Re-organize in-memory character profile storage.
Now uses a dictionary of int -> profile instead of an array filled with nulls.
This commit is contained in:
@@ -68,7 +68,7 @@ namespace Content.Tests.Server.Preferences
|
||||
var originalProfile = CharlieCharlieson();
|
||||
await db.InitPrefsAsync(username, originalProfile);
|
||||
var prefs = await db.GetPlayerPreferencesAsync(username);
|
||||
Assert.That(prefs.Characters.ElementAt(slot).MemberwiseEquals(originalProfile));
|
||||
Assert.That(prefs.Characters.Single(p => p.Key == slot).Value.MemberwiseEquals(originalProfile));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -81,7 +81,7 @@ namespace Content.Tests.Server.Preferences
|
||||
await db.SaveSelectedCharacterIndexAsync(username, 1);
|
||||
await db.SaveCharacterSlotAsync(username, null, 1);
|
||||
var prefs = await db.GetPlayerPreferencesAsync(username);
|
||||
Assert.That(prefs.Characters.Skip(1).All(character => character is null));
|
||||
Assert.That(!prefs.Characters.Any(p => p.Key != 0));
|
||||
}
|
||||
|
||||
private static NetUserId NewUserId()
|
||||
|
||||
Reference in New Issue
Block a user