Change character names to use datasets prototypes (#3259)

* Remove old name lists in .txts

* Fix tests

* LATEST MASTER TECHNOLOGY
This commit is contained in:
DrSmugleaf
2021-02-17 10:46:44 +01:00
committed by GitHub
parent 25c884a84d
commit c435b5150d
9 changed files with 70 additions and 2064 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Database;
@@ -8,15 +9,33 @@ using Content.Shared.Preferences;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using Robust.Shared.IoC;
using Robust.Shared.Localization.Macros;
using Robust.Shared.Maths;
using Robust.Shared.Network;
using Robust.Shared.Localization.Macros;
using Robust.Shared.Prototypes;
namespace Content.Tests.Server.Preferences
{
[TestFixture]
public class ServerDbSqliteTests : ContentUnitTest
{
private const string Prototypes = @"
- type: dataset
id: names_first_male
values:
- Aaden
- type: dataset
id: names_first_female
values:
- Aaliyah
- type: dataset
id: names_last
values:
- Ackerley";
private static HumanoidCharacterProfile CharlieCharlieson()
{
return new(
@@ -77,6 +96,7 @@ namespace Content.Tests.Server.Preferences
{
var db = GetDb();
var username = new NetUserId(new Guid("640bd619-fc8d-4fe2-bf3c-4a5fb17d6ddd"));
IoCManager.Resolve<IPrototypeManager>().LoadFromStream(new StringReader(Prototypes));
await db.InitPrefsAsync(username, HumanoidCharacterProfile.Default());
await db.SaveCharacterSlotAsync(username, CharlieCharlieson(), 1);
await db.SaveSelectedCharacterIndexAsync(username, 1);