Dependency update / fixes / skrungle bungle (#23745)

* Give .props files 2-space indents.

* Move to Central Package Management.

Allows us to store NuGet package versions all in one place. Yay!

* Update NuGet packages and fix code for changes.

Notable:

Changes to ILVerify.
Npgsql doesn't need hacks for inet anymore, now we need hacks to make the old code work with this new reality.
NUnit's analyzers are already complaining and I didn't even update it to 4.x yet.
TerraFX changed to GetLastSystemError so error handling had to be changed.
Buncha APIs have more NRT annotations.

* Remove dotnet-eng NuGet package source.

I genuinely don't know what this was for, and Central Package Management starts throwing warnings about it, so YEET.

* Remove Robust.Physics project.

Never used.

* Remove erroneous NVorbis reference.

Should be VorbisPizza and otherwise wasn't used.

* Sandbox fixes

* Remove unused unit test package references.

Castle.Core and NUnit.ConsoleRunner.

* Update NUnit to 4.0.1

This requires replacing all the old assertion methods because they removed them 🥲

* Oh so that's what dotnet-eng was used for. Yeah ok that makes sense.

* Add Robust.Analyzers.Test

* Update submodule

* commit to re-run CI
This commit is contained in:
Pieter-Jan Briers
2024-01-12 23:22:01 +01:00
committed by GitHub
parent d2a1eae2d9
commit a6c9c36b68
44 changed files with 267 additions and 294 deletions

View File

@@ -8,9 +8,9 @@
<LangVersion>11</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Content.Client\Content.Client.csproj" />

View File

@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System.IO;
using System.Linq;
using Content.Server.GameTicking;
@@ -203,17 +203,17 @@ public sealed partial class TestPair : IAsyncDisposable
if (settings.InLobby)
{
Assert.Null(session.AttachedEntity);
Assert.That(session.AttachedEntity, Is.Null);
return;
}
Assert.NotNull(session.AttachedEntity);
Assert.That(session.AttachedEntity, Is.Not.Null);
Assert.That(entMan.EntityExists(session.AttachedEntity));
Assert.That(entMan.HasComponent<MindContainerComponent>(session.AttachedEntity));
var mindCont = entMan.GetComponent<MindContainerComponent>(session.AttachedEntity!.Value);
Assert.NotNull(mindCont.Mind);
Assert.True(entMan.TryGetComponent(mindCont.Mind, out MindComponent? mind));
Assert.Null(mind!.VisitingEntity);
Assert.That(mindCont.Mind, Is.Not.Null);
Assert.That(entMan.TryGetComponent(mindCont.Mind, out MindComponent? mind));
Assert.That(mind!.VisitingEntity, Is.Null);
Assert.That(mind.OwnedEntity, Is.EqualTo(session.AttachedEntity!.Value));
Assert.That(mind.UserId, Is.EqualTo(session.UserId));
}

View File

@@ -337,10 +337,10 @@ public static partial class PoolManager
{
// If the _poolFailureReason is not null, we can assume at least one test failed.
// So we say inconclusive so we don't add more failed tests to search through.
Assert.Inconclusive(@"
Assert.Inconclusive(@$"
In a different test, the pool manager had an exception when trying to create a server/client pair.
Instead of risking that the pool manager will fail at creating a server/client pairs for every single test,
we are just going to end this here to save a lot of time. This is the exception that started this:\n {0}", _poolFailureReason);
we are just going to end this here to save a lot of time. This is the exception that started this:\n {_poolFailureReason}");
}
if (_dead)

View File

@@ -29,7 +29,7 @@ public sealed class ActionsAddedTest
var cActionSystem = client.System<SharedActionsSystem>();
// Dummy ticker is disabled - client should be in control of a normal mob.
Assert.NotNull(serverSession.AttachedEntity);
Assert.That(serverSession.AttachedEntity, Is.Not.Null);
var serverEnt = serverSession.AttachedEntity!.Value;
var clientEnt = clientSession!.AttachedEntity!.Value;
Assert.That(sEntMan.EntityExists(serverEnt));
@@ -57,8 +57,8 @@ public sealed class ActionsAddedTest
var sAct = sActions[0].Comp;
var cAct = cActions[0].Comp;
Assert.NotNull(sAct);
Assert.NotNull(cAct);
Assert.That(sAct, Is.Not.Null);
Assert.That(cAct, Is.Not.Null);
// Finally, these two actions are not the same object
// required, because integration tests do not respect the [NonSerialized] attribute and will simply events by reference.

View File

@@ -111,7 +111,7 @@ namespace Content.IntegrationTests.Tests.Buckle
// Side effects of buckling for the strap
Assert.That(strap.BuckledEntities, Does.Contain(human));
Assert.That(strap.OccupiedSize, Is.EqualTo(buckle.Size));
Assert.Positive(strap.OccupiedSize);
Assert.That(strap.OccupiedSize, Is.Positive);
});
#pragma warning disable NUnit2045 // Interdependent asserts.

View File

@@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
await server.WaitAssertion(() =>
{
CollectionAssert.AreEquivalent(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.EquivalentTo(deviceNetTestSystem.LastPayload));
});
await pair.CleanReturnAsync();
}
@@ -170,7 +170,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
await server.WaitAssertion(() =>
{
CollectionAssert.AreEqual(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.EqualTo(deviceNetTestSystem.LastPayload).AsCollection);
payload = new NetworkPayload
{
@@ -187,7 +187,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
await server.WaitAssertion(() =>
{
CollectionAssert.AreNotEqual(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.Not.EqualTo(deviceNetTestSystem.LastPayload).AsCollection);
});
await pair.CleanReturnAsync();
@@ -270,7 +270,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
await server.WaitAssertion(() =>
{
CollectionAssert.AreEqual(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.EqualTo(deviceNetTestSystem.LastPayload).AsCollection);
});
await pair.CleanReturnAsync();

View File

@@ -60,7 +60,7 @@ public sealed class GhostRoleTests
Assert.That(session.AttachedEntity, Is.EqualTo(originalMob));
var originalMind = entMan.GetComponent<MindComponent>(originalMindId);
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob));
Assert.Null(originalMind.VisitingEntity);
Assert.That(originalMind.VisitingEntity, Is.Null);
// Use the ghost command
conHost.ExecuteCommand("ghost");
@@ -90,11 +90,11 @@ public sealed class GhostRoleTests
Assert.That(newMindId, Is.Not.EqualTo(originalMindId));
Assert.That(session.AttachedEntity, Is.EqualTo(ghostRole));
Assert.That(newMind.OwnedEntity, Is.EqualTo(ghostRole));
Assert.Null(newMind.VisitingEntity);
Assert.That(newMind.VisitingEntity, Is.Null);
// Original mind should be unaffected, but the ghost will have deleted itself.
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob));
Assert.Null(originalMind.VisitingEntity);
Assert.That(originalMind.VisitingEntity, Is.Null);
Assert.That(entMan.Deleted(ghost));
// Ghost again.
@@ -113,11 +113,11 @@ public sealed class GhostRoleTests
await pair.RunTicksSync(10);
Assert.That(session.AttachedEntity, Is.EqualTo(originalMob));
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob));
Assert.Null(originalMind.VisitingEntity);
Assert.That(originalMind.VisitingEntity, Is.Null);
// the ghost-role mind is unaffected, though the ghost will have deleted itself
Assert.That(newMind.OwnedEntity, Is.EqualTo(ghostRole));
Assert.Null(newMind.VisitingEntity);
Assert.That(newMind.VisitingEntity, Is.Null);
Assert.That(entMan.Deleted(otherGhost));
await pair.CleanReturnAsync();

View File

@@ -36,8 +36,8 @@ public sealed partial class MindTests
await pair.RunTicksSync(5);
// Client is not attached to anything
Assert.Null(pair.Client.Player?.ControlledEntity);
Assert.Null(pair.PlayerData?.Mind);
Assert.That(pair.Client.Player?.ControlledEntity, Is.Null);
Assert.That(pair.PlayerData?.Mind, Is.Null);
// Attempt to ghost
var cConHost = pair.Client.ResolveDependency<IConsoleHost>();

View File

@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Robust.Server.Player;
@@ -127,7 +127,7 @@ public sealed partial class MindTests
var mindSys = entMan.System<SharedMindSystem>();
var mind = GetMind(pair);
Assert.Null(mind.Comp.VisitingEntity);
Assert.That(mind.Comp.VisitingEntity, Is.Null);
// Make player visit a new mob
var original = mind.Comp.OwnedEntity;
@@ -165,8 +165,8 @@ public sealed partial class MindTests
await using var pair = await SetupPair();
var mind = GetMind(pair);
Assert.Null(mind.Comp.VisitingEntity);
Assert.NotNull(mind.Comp.OwnedEntity);
Assert.That(mind.Comp.VisitingEntity, Is.Null);
Assert.That(mind.Comp.OwnedEntity, Is.Not.Null);
var entity = mind.Comp.OwnedEntity;
await pair.RunTicksSync(5);
@@ -175,7 +175,7 @@ public sealed partial class MindTests
var newMind = GetMind(pair);
Assert.Null(newMind.Comp.VisitingEntity);
Assert.That(newMind.Comp.VisitingEntity, Is.Null);
Assert.That(newMind.Comp.OwnedEntity, Is.EqualTo(entity));
Assert.That(newMind.Id, Is.EqualTo(mind.Id));

View File

@@ -298,7 +298,7 @@ namespace Content.IntegrationTests.Tests
Assert.That(gameMaps.Remove(PoolManager.TestMap));
CollectionAssert.AreEquivalent(GameMaps.ToHashSet(), gameMaps, "Game map prototype missing from test cases.");
Assert.That(gameMaps, Is.EquivalentTo(GameMaps.ToHashSet()), "Game map prototype missing from test cases.");
await pair.CleanReturnAsync();
}

View File

@@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Preferences
var pair = await PoolManager.GetServerClient();
var db = GetDb(pair.Server);
// Database should be empty so a new GUID should do it.
Assert.Null(await db.GetPlayerPreferencesAsync(NewUserId()));
Assert.That(await db.GetPlayerPreferencesAsync(NewUserId()), Is.Null);
await pair.CleanReturnAsync();
}

View File

@@ -26,7 +26,7 @@ public sealed partial class SerializationTest
var node = seriMan.WriteValue(value, notNullableOverride:true);
var valueNode = node as ValueDataNode;
Assert.NotNull(valueNode);
Assert.That(valueNode, Is.Not.Null);
var expected = refMan.GetEnumReference(value);
Assert.That(valueNode!.Value, Is.EqualTo(expected));

View File

@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System.Collections.Generic;
using Content.IntegrationTests.Pair;
using Content.Server.Administration.Managers;
@@ -38,7 +38,7 @@ public abstract class ToolshedTest : IInvocationContext
protected virtual async Task TearDown()
{
Assert.IsEmpty(_expectedErrors);
Assert.That(_expectedErrors, Is.Empty);
ClearErrors();
}