diff --git a/.editorconfig b/.editorconfig
index 9f2e43c86..85cea687b 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -10,5 +10,8 @@ charset = utf-8
[*.{csproj,xml,yml,dll.config,targets,props}]
indent_size = 2
+[nuget.config]
+indent_size = 2
+
[*.gdsl]
indent_style = tab
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 000000000..1e6b2698c
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MSBuild/Robust.Properties.targets b/MSBuild/Robust.Properties.targets
index 73ac52052..d7e75e720 100644
--- a/MSBuild/Robust.Properties.targets
+++ b/MSBuild/Robust.Properties.targets
@@ -4,6 +4,7 @@
net8.0
+ true
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index a22a18532..51e785a0d 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -35,7 +35,10 @@ END TEMPLATE-->
### Breaking changes
-*None yet*
+* The unused `Robust.Physics` project has been deleted.
+* The project now uses [Central Package Management](https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management).
+* (Almost) all the NuGet packages have been updated. This causes many problems. I am so sorry.
+* Cleaned up some unused packages as well.
### New features
@@ -63,7 +66,7 @@ END TEMPLATE-->
### Bugfixes
-* Avoid buggy behavior if a Bound UI is closed inside the `BoundUIOpenedEvent` that's opening it.
+* Avoid loading assemblies from content `/Assemblies` if Robust ships its own copy. This avoid duplicate or weird mismatching version issues.
### Other
diff --git a/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj b/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj
index 7a9530f46..431fe38fa 100644
--- a/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj
+++ b/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj
@@ -1,23 +1,26 @@
-
-
-
+
+
+
false
-
+
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Robust.Analyzers/Robust.Analyzers.csproj b/Robust.Analyzers/Robust.Analyzers.csproj
index af441887e..bcba84910 100644
--- a/Robust.Analyzers/Robust.Analyzers.csproj
+++ b/Robust.Analyzers/Robust.Analyzers.csproj
@@ -3,19 +3,20 @@
netstandard2.0
10
+ true
-
-
-
+
+
+
-
+
diff --git a/Robust.Benchmarks/Configs/DefaultSQLConfig.cs b/Robust.Benchmarks/Configs/DefaultSQLConfig.cs
index 3dcd0f346..566276210 100644
--- a/Robust.Benchmarks/Configs/DefaultSQLConfig.cs
+++ b/Robust.Benchmarks/Configs/DefaultSQLConfig.cs
@@ -1,15 +1,18 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Globalization;
using BenchmarkDotNet.Analysers;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
+using BenchmarkDotNet.EventProcessors;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Filters;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Reports;
+using BenchmarkDotNet.Running;
using BenchmarkDotNet.Validators;
using Robust.Benchmarks.Exporters;
@@ -44,10 +47,16 @@ public sealed class DefaultSQLConfig : IConfig
public IEnumerable GetLogicalGroupRules() => DefaultConfig.Instance.GetLogicalGroupRules();
+ public IEnumerable GetEventProcessors() => DefaultConfig.Instance.GetEventProcessors();
+
+ public IEnumerable GetColumnHidingRules() => DefaultConfig.Instance.GetColumnHidingRules();
public IOrderer Orderer => DefaultConfig.Instance.Orderer!;
+ public ICategoryDiscoverer? CategoryDiscoverer => DefaultConfig.Instance.CategoryDiscoverer;
public SummaryStyle SummaryStyle => DefaultConfig.Instance.SummaryStyle;
public ConfigUnionRule UnionRule => DefaultConfig.Instance.UnionRule;
public string ArtifactsPath => DefaultConfig.Instance.ArtifactsPath;
public CultureInfo CultureInfo => DefaultConfig.Instance.CultureInfo!;
public ConfigOptions Options => DefaultConfig.Instance.Options;
+ public TimeSpan BuildTimeout => DefaultConfig.Instance.BuildTimeout;
+ public IReadOnlyList ConfigAnalysisConclusion => DefaultConfig.Instance.ConfigAnalysisConclusion;
}
diff --git a/Robust.Benchmarks/Robust.Benchmarks.csproj b/Robust.Benchmarks/Robust.Benchmarks.csproj
index 8dfe2500d..d394cf53e 100644
--- a/Robust.Benchmarks/Robust.Benchmarks.csproj
+++ b/Robust.Benchmarks/Robust.Benchmarks.csproj
@@ -13,12 +13,12 @@
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
diff --git a/Robust.Client.Injectors/Robust.Client.Injectors.csproj b/Robust.Client.Injectors/Robust.Client.Injectors.csproj
index 6f29ef79f..bb71eaa05 100644
--- a/Robust.Client.Injectors/Robust.Client.Injectors.csproj
+++ b/Robust.Client.Injectors/Robust.Client.Injectors.csproj
@@ -6,8 +6,8 @@
-
-
+
+
diff --git a/Robust.Client.NameGenerator/Robust.Client.NameGenerator.csproj b/Robust.Client.NameGenerator/Robust.Client.NameGenerator.csproj
index f1a34a261..51ff69c86 100644
--- a/Robust.Client.NameGenerator/Robust.Client.NameGenerator.csproj
+++ b/Robust.Client.NameGenerator/Robust.Client.NameGenerator.csproj
@@ -2,11 +2,12 @@
netstandard2.0
+ true
-
-
+
+
diff --git a/Robust.Client.WebView/Robust.Client.WebView.csproj b/Robust.Client.WebView/Robust.Client.WebView.csproj
index fc2111962..bbd3fe5b3 100644
--- a/Robust.Client.WebView/Robust.Client.WebView.csproj
+++ b/Robust.Client.WebView/Robust.Client.WebView.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs b/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
index ebda3975e..8d6bee170 100644
--- a/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
+++ b/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
@@ -224,8 +224,8 @@ namespace Robust.Client.Graphics.Clyde
fixed (char* pCaption = "RobustToolbox: Failed to create window")
{
Windows.MessageBoxW(HWND.NULL,
- (ushort*) pText,
- (ushort*) pCaption,
+ pText,
+ pCaption,
MB.MB_OK | MB.MB_ICONERROR);
}
}
diff --git a/Robust.Client/Graphics/Clyde/GLContext/GLContextAngle.cs b/Robust.Client/Graphics/Clyde/GLContext/GLContextAngle.cs
index 5d1d1dd0c..f05b3187d 100644
--- a/Robust.Client/Graphics/Clyde/GLContext/GLContextAngle.cs
+++ b/Robust.Client/Graphics/Clyde/GLContext/GLContextAngle.cs
@@ -413,7 +413,7 @@ namespace Robust.Client.Graphics.Clyde
DXGI_ADAPTER_DESC1 desc;
ThrowIfFailed("GetDesc1", _adapter->GetDesc1(&desc));
- var descName = new ReadOnlySpan(desc.Description, 128).TrimEnd('\0');
+ var descName = ((ReadOnlySpan)desc.Description).TrimEnd('\0');
Logger.DebugS("clyde.ogl.angle", "Successfully created D3D11 device!");
Logger.DebugS("clyde.ogl.angle", $"D3D11 Device Adapter: {descName.ToString()}");
@@ -493,7 +493,7 @@ namespace Robust.Client.Graphics.Clyde
DXGI_ADAPTER_DESC1 desc;
ThrowIfFailed("GetDesc1", adapter->GetDesc1(&desc));
- var descName = new ReadOnlySpan(desc.Description, 128);
+ var descName = ((ReadOnlySpan)desc.Description);
if (descName.StartsWith(name))
return adapter;
diff --git a/Robust.Client/Graphics/Clyde/VramCommand.cs b/Robust.Client/Graphics/Clyde/VramCommand.cs
index b52dff0cf..47819033e 100644
--- a/Robust.Client/Graphics/Clyde/VramCommand.cs
+++ b/Robust.Client/Graphics/Clyde/VramCommand.cs
@@ -36,7 +36,7 @@ namespace Robust.Client.Graphics.Clyde
adapter->Release();
ThrowIfFailed("GetDesc", adapter3->GetDesc2(&desc));
- var descString = new ReadOnlySpan(desc.Description, 128).TrimEnd('\0');
+ var descString = ((ReadOnlySpan)desc.Description).TrimEnd('\0');
shell.WriteLine(descString.ToString());
DXGI_QUERY_VIDEO_MEMORY_INFO memInfo;
diff --git a/Robust.Client/Robust.Client.csproj b/Robust.Client/Robust.Client.csproj
index a3fc56e3e..40c335746 100644
--- a/Robust.Client/Robust.Client.csproj
+++ b/Robust.Client/Robust.Client.csproj
@@ -5,33 +5,33 @@
true
WinExe
false
- NU1701
+ NU1701;CA1416
../bin/Client
true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -40,7 +40,6 @@
-
diff --git a/Robust.Packaging/AssetProcessing/Passes/AssetPassPackRsis.cs b/Robust.Packaging/AssetProcessing/Passes/AssetPassPackRsis.cs
index 5b0f04e17..ff0cff2cd 100644
--- a/Robust.Packaging/AssetProcessing/Passes/AssetPassPackRsis.cs
+++ b/Robust.Packaging/AssetProcessing/Passes/AssetPassPackRsis.cs
@@ -4,6 +4,7 @@ using Robust.Shared.Resources;
using Robust.Shared.Utility;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Png;
+using SixLabors.ImageSharp.Formats.Png.Chunks;
using SixLabors.ImageSharp.PixelFormats;
namespace Robust.Packaging.AssetProcessing.Passes;
@@ -168,7 +169,7 @@ internal sealed class AssetPassPackRsis : AssetPass
}
var ms = new MemoryStream();
- sheet.Metadata.GetPngMetadata().TextData.Add(new PngTextData("Description", metaJson, null, null));
+ sheet.Metadata.GetPngMetadata().TextData.Add(new PngTextData("Description", metaJson, "", ""));
sheet.SaveAsPng(ms);
sheet.Dispose();
diff --git a/Robust.Packaging/Robust.Packaging.csproj b/Robust.Packaging/Robust.Packaging.csproj
index 06cdf2ec8..d6ab2e72e 100644
--- a/Robust.Packaging/Robust.Packaging.csproj
+++ b/Robust.Packaging/Robust.Packaging.csproj
@@ -10,9 +10,5 @@
-
-
-
-
diff --git a/Robust.Physics/Robust.Physics.csproj b/Robust.Physics/Robust.Physics.csproj
deleted file mode 100644
index a4de8af11..000000000
--- a/Robust.Physics/Robust.Physics.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
- true
- DEBUG;TRACE
-
-
-
- true
- TRACE;RELEASE
-
-
-
-
-
-
-
-
diff --git a/Robust.Serialization.Generator/Robust.Serialization.Generator.csproj b/Robust.Serialization.Generator/Robust.Serialization.Generator.csproj
index 95fbe9ea5..8b7a626e1 100644
--- a/Robust.Serialization.Generator/Robust.Serialization.Generator.csproj
+++ b/Robust.Serialization.Generator/Robust.Serialization.Generator.csproj
@@ -4,12 +4,13 @@
netstandard2.0
11
enable
+ true
-
-
-
+
+
+
diff --git a/Robust.Server/DataMetrics/MetricsManager.MetricsServer.cs b/Robust.Server/DataMetrics/MetricsManager.MetricsServer.cs
index b3a1ba2e0..958a3e903 100644
--- a/Robust.Server/DataMetrics/MetricsManager.MetricsServer.cs
+++ b/Robust.Server/DataMetrics/MetricsManager.MetricsServer.cs
@@ -19,13 +19,15 @@ internal sealed partial class MetricsManager
{
private readonly ISawmill _sawmill;
private readonly HttpListener _listener;
+ private readonly CollectorRegistry _registry;
public ManagedHttpListenerMetricsServer(ISawmill sawmill, string host, int port, string url = "metrics/",
- CollectorRegistry? registry = null) : base(registry)
+ CollectorRegistry? registry = null)
{
_sawmill = sawmill;
_listener = new HttpListener();
_listener.Prefixes.Add($"http://{host}:{port}/{url}");
+ _registry = registry ?? Metrics.DefaultRegistry;
}
protected override Task StartServer(CancellationToken cancel)
diff --git a/Robust.Server/Log/LokiLogHandler.cs b/Robust.Server/Log/LokiLogHandler.cs
index cdb23cdff..4a639aef1 100644
--- a/Robust.Server/Log/LokiLogHandler.cs
+++ b/Robust.Server/Log/LokiLogHandler.cs
@@ -27,7 +27,7 @@ namespace Robust.Server.Log
if (valid)
{
- message.AddOrUpdateProperty(sawmillProperty);
+ message.AddOrUpdateProperty(sawmillProperty!);
}
_sLogger.Write(message);
diff --git a/Robust.Server/Robust.Server.csproj b/Robust.Server/Robust.Server.csproj
index cf899ea89..30fcd66ca 100644
--- a/Robust.Server/Robust.Server.csproj
+++ b/Robust.Server/Robust.Server.csproj
@@ -10,27 +10,30 @@
false
true
+ CA1416
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/Robust.Server/Scripting/ScriptHost.cs b/Robust.Server/Scripting/ScriptHost.cs
index 06e43248e..e4dd9115e 100644
--- a/Robust.Server/Scripting/ScriptHost.cs
+++ b/Robust.Server/Scripting/ScriptHost.cs
@@ -297,25 +297,20 @@ namespace Robust.Server.Scripting
var results = await (CompletionService
.GetService(document)?
- .GetCompletionsAsync(document, message.Cursor) ?? Task.FromResult(null));
+ .GetCompletionsAsync(document, message.Cursor) ?? Task.FromResult(CompletionList.Empty));
- if (results is not null)
- {
- var ires = ImmutableArray.CreateBuilder();
- foreach (var r in results.Items)
- ires.Add(new LiteResult(
- displayText: r.DisplayText,
- displayTextPrefix: r.DisplayTextPrefix,
- displayTextSuffix: r.DisplayTextSuffix,
- inlineDescription: r.InlineDescription,
- tags: r.Tags,
- properties: r.Properties
- ));
+ var ires = ImmutableArray.CreateBuilder();
+ foreach (var r in results.ItemsList)
+ ires.Add(new LiteResult(
+ displayText: r.DisplayText,
+ displayTextPrefix: r.DisplayTextPrefix,
+ displayTextSuffix: r.DisplayTextSuffix,
+ inlineDescription: r.InlineDescription,
+ tags: r.Tags,
+ properties: r.Properties
+ ));
- replyMessage.Results = ires.ToImmutable();
- }
- else
- replyMessage.Results = ImmutableArray.Empty;
+ replyMessage.Results = ires.ToImmutable();
_netManager.ServerSendMessage(replyMessage, message.MsgChannel);
}
diff --git a/Robust.Server/ServerStatus/StatusHost.Acz.cs b/Robust.Server/ServerStatus/StatusHost.Acz.cs
index 43e9e36d9..dfdaf9fc1 100644
--- a/Robust.Server/ServerStatus/StatusHost.Acz.cs
+++ b/Robust.Server/ServerStatus/StatusHost.Acz.cs
@@ -308,7 +308,7 @@ namespace Robust.Server.ServerStatus
private static bool RequestWantsZStd(IStatusHandlerContext context)
{
// Yeah this isn't a good parser for Accept-Encoding but who cares.
- return context.RequestHeaders.TryGetValue("Accept-Encoding", out var ac) && ac.Count > 0 && ac[0].Contains("zstd");
+ return context.RequestHeaders.TryGetValue("Accept-Encoding", out var ac) && ac.Count > 0 && ac[0]?.Contains("zstd") == true;
}
// Only call this if the download URL is not available!
diff --git a/Robust.Shared.CompNetworkGenerator/Robust.Shared.CompNetworkGenerator.csproj b/Robust.Shared.CompNetworkGenerator/Robust.Shared.CompNetworkGenerator.csproj
index 3372817dd..c12253963 100644
--- a/Robust.Shared.CompNetworkGenerator/Robust.Shared.CompNetworkGenerator.csproj
+++ b/Robust.Shared.CompNetworkGenerator/Robust.Shared.CompNetworkGenerator.csproj
@@ -3,10 +3,11 @@
netstandard2.0
9
+ true
-
-
+
+
diff --git a/Robust.Shared.Maths/Robust.Shared.Maths.csproj b/Robust.Shared.Maths/Robust.Shared.Maths.csproj
index 5815371de..cb73478a3 100644
--- a/Robust.Shared.Maths/Robust.Shared.Maths.csproj
+++ b/Robust.Shared.Maths/Robust.Shared.Maths.csproj
@@ -6,7 +6,7 @@
true
-
+
diff --git a/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj b/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj
index 59c108282..571a8af49 100644
--- a/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj
+++ b/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj
@@ -7,11 +7,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/Robust.Shared/ContentPack/AssemblyTypeChecker.cs b/Robust.Shared/ContentPack/AssemblyTypeChecker.cs
index 2aea4e02e..5abc486cf 100644
--- a/Robust.Shared/ContentPack/AssemblyTypeChecker.cs
+++ b/Robust.Shared/ContentPack/AssemblyTypeChecker.cs
@@ -913,9 +913,14 @@ namespace Robust.Shared.ContentPack
return null;
}
- public PEReader? Resolve(string simpleName)
+ public PEReader? ResolveAssembly(AssemblyName assemblyName)
{
- return _dictionary.GetOrAdd(simpleName, ResolveCore);
+ return _dictionary.GetOrAdd(assemblyName.Name!, ResolveCore);
+ }
+
+ public PEReader? ResolveModule(AssemblyName referencingAssembly, string fileName)
+ {
+ throw new NotSupportedException();
}
public void Dispose()
diff --git a/Robust.Shared/ContentPack/ModLoader.cs b/Robust.Shared/ContentPack/ModLoader.cs
index b7f92c886..57a91d2ef 100644
--- a/Robust.Shared/ContentPack/ModLoader.cs
+++ b/Robust.Shared/ContentPack/ModLoader.cs
@@ -325,19 +325,23 @@ namespace Robust.Shared.ContentPack
{
lock (_lock)
{
- Sawmill.Debug("ResolvingAssembly {0}", name);
+ Sawmill.Verbose("ResolvingAssembly {0}", name);
// Try main modules.
foreach (var mod in Mods)
{
if (mod.GameAssembly.FullName == name.FullName)
{
+ Sawmill.Verbose($"Found assembly in modloader ALC: {mod.GameAssembly}");
return mod.GameAssembly;
}
}
if (TryLoadExtra(name) is { } asm)
+ {
+ Sawmill.Verbose($"Found assembly through extra loader: {asm}");
return asm;
+ }
// Do not allow sideloading when sandboxing is enabled.
// Side loaded assemblies would not be checked for sandboxing currently, so we can't have that.
@@ -347,18 +351,42 @@ namespace Robust.Shared.ContentPack
{
if (assembly.FullName == name.FullName)
{
+ Sawmill.Verbose($"Found assembly in existing side modules: {assembly}");
return assembly;
}
}
+ // Try to resolve assemblies in the default AssemblyLoadContext.
+ // If we don't do this manually, the sideloading code below could load assemblies from content,
+ // even if Robust provides its own versions.
+ // This can lead to:
+ // * Multiple copies of the same assembly being loaded.
+ // * Mismatching versions of dependencies being loaded.
+ // * e.g. Microsoft.Extensions.Primitives 6.0 with Microsoft.Extensions.DependencyInjection 7.0
+ //
+ // Now, to be clear, this is 100% an error in packaging. But it's also one that's really easy to make.
+ //
+ try
+ {
+ var defaultAssembly = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(name.Name!));
+ Sawmill.Verbose($"Found assembly through default ALC (early): {defaultAssembly}");
+ return defaultAssembly;
+ }
+ catch
+ {
+ // Assume assembly not loadable from Robust's directory, proceed with loading from content.
+ }
+
if (_res.TryContentFileRead($"/Assemblies/{name.Name}.dll", out var dll))
{
var assembly = _loadContext.LoadFromStream(dll);
_sideModules.Add(assembly);
+ Sawmill.Verbose($"Found assembly in NEW side module: {assembly}");
return assembly;
}
}
+ Sawmill.Verbose("Did not find assembly directly. Should fall back to default ALC.");
return null;
}
}
@@ -381,7 +409,7 @@ namespace Robust.Shared.ContentPack
// Otherwise it would load the assemblies a second time which is an amazing way to have everything break.
if (_useLoadContext)
{
- Sawmill.Debug($"RESOLVING DEFAULT: {name}");
+ Sawmill.Verbose($"RESOLVING DEFAULT: {name}");
foreach (var module in LoadedModules)
{
if (module.GetName().Name == name.Name)
diff --git a/Robust.Shared/ContentPack/Sandbox.yml b/Robust.Shared/ContentPack/Sandbox.yml
index af787d36c..f5073bcac 100644
--- a/Robust.Shared/ContentPack/Sandbox.yml
+++ b/Robust.Shared/ContentPack/Sandbox.yml
@@ -1408,4 +1408,7 @@ Types:
# should be fine to do All: True, but this has some methods to read filestreams. So just in case this ever adds an extension method that directly opens a file:
Methods:
- "!!0 ParseOrThrow<>(Pidgin.Parser`2, string, System.Func`3)"
+ - "!!0 ParseOrThrow<>(Pidgin.Parser`2, string, Pidgin.Configuration.IConfiguration`1)"
SourcePos: { }
+ Pidgin.Configuration:
+ IConfiguration`1: { All: True }
diff --git a/Robust.Shared/GameObjects/RobustMemoryManager.cs b/Robust.Shared/GameObjects/RobustMemoryManager.cs
index 7337b2039..b1219abd9 100644
--- a/Robust.Shared/GameObjects/RobustMemoryManager.cs
+++ b/Robust.Shared/GameObjects/RobustMemoryManager.cs
@@ -13,10 +13,10 @@ internal sealed class RobustMemoryManager
// Let's be real this is a bandaid for pooling bullshit at an engine level and I don't know what
// good memory management looks like for PVS or the RobustSerializer.
- private static readonly RecyclableMemoryStreamManager MemStreamManager = new()
+ private static readonly RecyclableMemoryStreamManager MemStreamManager = new(new RecyclableMemoryStreamManager.Options
{
ThrowExceptionOnToArray = true,
- };
+ });
public RobustMemoryManager()
{
diff --git a/Robust.Shared/Log/LogManager.Sawmill.cs b/Robust.Shared/Log/LogManager.Sawmill.cs
index b1c509b21..25354f516 100644
--- a/Robust.Shared/Log/LogManager.Sawmill.cs
+++ b/Robust.Shared/Log/LogManager.Sawmill.cs
@@ -73,7 +73,9 @@ namespace Robust.Shared.Log
public void Log(LogLevel level, Exception? exception, string message, params object?[] args)
{
- _sLogger.BindMessageTemplate(message, args, out var parsedTemplate, out var properties);
+ if (!_sLogger.BindMessageTemplate(message, args, out var parsedTemplate, out var properties))
+ return;
+
var msg = new LogEvent(DateTimeOffset.Now, level.ToSerilog(), exception, parsedTemplate, properties);
LogInternal(Name, msg);
}
diff --git a/Robust.Shared/Robust.Shared.csproj b/Robust.Shared/Robust.Shared.csproj
index 8bd4b4e23..333cbd5a9 100644
--- a/Robust.Shared/Robust.Shared.csproj
+++ b/Robust.Shared/Robust.Shared.csproj
@@ -4,30 +4,30 @@
false
false
true
+ CA1416
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/Robust.Shared/Timing/PrecisionSleep.cs b/Robust.Shared/Timing/PrecisionSleep.cs
index d98ee3199..328e021cd 100644
--- a/Robust.Shared/Timing/PrecisionSleep.cs
+++ b/Robust.Shared/Timing/PrecisionSleep.cs
@@ -63,7 +63,7 @@ internal sealed unsafe class PrecisionSleepWindowsHighResolution : PrecisionSlee
Windows.TIMER_ALL_ACCESS);
if (_timerHandle == HANDLE.NULL)
- Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
+ Marshal.ThrowExceptionForHR(Windows.HRESULT_FROM_WIN32(Marshal.GetLastSystemError()));
}
public override void Sleep(TimeSpan time)
@@ -82,11 +82,11 @@ internal sealed unsafe class PrecisionSleepWindowsHighResolution : PrecisionSlee
);
if (!success)
- Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
+ Marshal.ThrowExceptionForHR(Windows.HRESULT_FROM_WIN32(Marshal.GetLastSystemError()));
var waitResult = Windows.WaitForSingleObject(_timerHandle, Windows.INFINITE);
if (waitResult == WAIT.WAIT_FAILED)
- Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
+ Marshal.ThrowExceptionForHR(Windows.HRESULT_FROM_WIN32(Marshal.GetLastSystemError()));
GC.KeepAlive(this);
}
diff --git a/Robust.Shared/Utility/FileHelper.cs b/Robust.Shared/Utility/FileHelper.cs
index 6dfcea493..e4526bf5f 100644
--- a/Robust.Shared/Utility/FileHelper.cs
+++ b/Robust.Shared/Utility/FileHelper.cs
@@ -50,7 +50,7 @@ internal static class FileHelper
fixed (char* pPath = path)
{
file = Windows.CreateFileW(
- (ushort*)pPath,
+ pPath,
Windows.GENERIC_READ,
FILE.FILE_SHARE_READ,
null,
@@ -61,7 +61,7 @@ internal static class FileHelper
if (file == HANDLE.INVALID_VALUE)
{
- var lastError = Marshal.GetLastWin32Error();
+ var lastError = Marshal.GetLastSystemError();
if (lastError is ERROR.ERROR_FILE_NOT_FOUND or ERROR.ERROR_PATH_NOT_FOUND)
{
stream = null;
diff --git a/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs b/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs
index 4155e2dab..3c86ca8b2 100644
--- a/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs
+++ b/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs
@@ -81,7 +81,7 @@ namespace Robust.UnitTesting.Client.GameStates
timing.LastProcessedTick = new GameTick(2);
processor.TryGetServerState(out var state, out _);
- Assert.NotNull(state);
+ Assert.That(state, Is.Not.Null);
Assert.That(state!.ToSequence.Value, Is.EqualTo(1));
}
diff --git a/Robust.UnitTesting/Robust.UnitTesting.csproj b/Robust.UnitTesting/Robust.UnitTesting.csproj
index 1f51dee7b..c14f58901 100644
--- a/Robust.UnitTesting/Robust.UnitTesting.csproj
+++ b/Robust.UnitTesting/Robust.UnitTesting.csproj
@@ -7,21 +7,18 @@
true
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
diff --git a/Robust.UnitTesting/Shared/Collections/OverflowDictionary_Test.cs b/Robust.UnitTesting/Shared/Collections/OverflowDictionary_Test.cs
index df4b9bb74..7d7eb7503 100644
--- a/Robust.UnitTesting/Shared/Collections/OverflowDictionary_Test.cs
+++ b/Robust.UnitTesting/Shared/Collections/OverflowDictionary_Test.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
@@ -23,8 +23,8 @@ public sealed class OverflowDictionary_Test
var dict = new OverflowDictionary(1, (_) => disposedCalled++);
dict.Add(0,0);
dict.Add(1,0);
- Assert.False(dict.ContainsKey(0));
- Assert.True(dict.ContainsKey(1));
+ Assert.That(dict.ContainsKey(0), Is.False);
+ Assert.That(dict.ContainsKey(1));
Assert.That(disposedCalled, Is.EqualTo(1));
Assert.That(dict.Count, Is.EqualTo(1));
}
@@ -56,7 +56,7 @@ public sealed class OverflowDictionary_Test
if(overlap > 0)
{
- Assert.False(dict.ContainsKey(0));
+ Assert.That(dict.ContainsKey(0), Is.False);
Assert.That(dict.Count, Is.EqualTo(test.size));
}
else
diff --git a/Robust.UnitTesting/Shared/Collections/OverflowQueue_Test.cs b/Robust.UnitTesting/Shared/Collections/OverflowQueue_Test.cs
index db022715d..9a10fdc02 100644
--- a/Robust.UnitTesting/Shared/Collections/OverflowQueue_Test.cs
+++ b/Robust.UnitTesting/Shared/Collections/OverflowQueue_Test.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using NUnit.Framework;
using Robust.Shared.Collections;
@@ -20,7 +20,7 @@ public sealed class OverflowQueue_Test
{
var queue = new OverflowQueue(test.size);
- Assert.False(queue.Contains(0));
+ Assert.That(queue.Contains(0), Is.False);
for (int i = 0; i < test.iterations; i++)
{
@@ -34,7 +34,7 @@ public sealed class OverflowQueue_Test
}
Assert.That(queue.Contains(test.iterations-1));
- Assert.False(queue.Contains(-1));
+ Assert.That(queue.Contains(-1), Is.False);
Assert.That(queue.Peek(), Is.EqualTo(overlap));
var array = queue.ToArray();
@@ -51,6 +51,6 @@ public sealed class OverflowQueue_Test
}
Assert.Throws(() => queue.Dequeue());
- Assert.False(queue.TryDequeue(out _));
+ Assert.That(queue.TryDequeue(out _), Is.False);
}
}
diff --git a/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs
index 6097e79c0..dee615eb8 100644
--- a/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs
+++ b/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs
@@ -48,16 +48,16 @@ namespace Robust.UnitTesting.Shared.GameObjects
Assert.Throws(() => componentFactory.GetComponent(NonexistentComponentName, true));
// Normal casing, do not ignore case, should exist
- Assert.IsInstanceOf(componentFactory.GetComponent(TestComponentName));
+ Assert.That(componentFactory.GetComponent(TestComponentName), Is.InstanceOf());
// Normal casing, ignore case, should exist
- Assert.IsInstanceOf(componentFactory.GetComponent(TestComponentName, true));
+ Assert.That(componentFactory.GetComponent(TestComponentName, true), Is.InstanceOf());
// Lower casing, do not ignore case, should not exist
Assert.Throws(() => componentFactory.GetComponent(LowercaseTestComponentName));
// Lower casing, ignore case, should exist
- Assert.IsInstanceOf(componentFactory.GetComponent(LowercaseTestComponentName, true));
+ Assert.That(componentFactory.GetComponent(LowercaseTestComponentName, true), Is.InstanceOf());
}
[Test]
@@ -88,20 +88,20 @@ namespace Robust.UnitTesting.Shared.GameObjects
var componentFactory = IoCManager.Resolve();
// Should not exist
- Assert.False(componentFactory.TryGetRegistration(NonexistentComponentName, out _));
- Assert.False(componentFactory.TryGetRegistration(NonexistentComponentName, out _, true));
+ Assert.That(componentFactory.TryGetRegistration(NonexistentComponentName, out _), Is.False);
+ Assert.That(componentFactory.TryGetRegistration(NonexistentComponentName, out _, true), Is.False);
// Normal casing, do not ignore case, should exist
- Assert.True(componentFactory.TryGetRegistration(TestComponentName, out _));
+ Assert.That(componentFactory.TryGetRegistration(TestComponentName, out _));
// Normal casing, ignore case, should exist
- Assert.True(componentFactory.TryGetRegistration(TestComponentName, out _, true));
+ Assert.That(componentFactory.TryGetRegistration(TestComponentName, out _, true));
// Lower casing, do not ignore case, should not exist
- Assert.False(componentFactory.TryGetRegistration(LowercaseTestComponentName, out _));
+ Assert.That(componentFactory.TryGetRegistration(LowercaseTestComponentName, out _), Is.False);
// Lower casing, ignore case, should exist
- Assert.True(componentFactory.TryGetRegistration(LowercaseTestComponentName, out _, true));
+ Assert.That(componentFactory.TryGetRegistration(LowercaseTestComponentName, out _, true));
}
[ComponentProtoName(TestComponentName)]
diff --git a/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs b/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs
index 8e1e5eddf..907950f78 100644
--- a/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs
+++ b/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs
@@ -347,7 +347,7 @@ namespace Robust.UnitTesting.Shared.GameObjects
}
var containerEnt = container.Owner;
- Assert.NotNull(container.Comp);
+ Assert.That(container.Comp, Is.Not.Null);
Assert.That(sEntManager.GetComponent(containerEnt).EntityName, Is.EqualTo("ContainerEnt"));
diff --git a/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs
index fd789c85c..6b9143245 100644
--- a/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs
+++ b/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs
@@ -214,7 +214,7 @@ namespace Robust.UnitTesting.Shared.GameObjects
entMan.RemoveComponentDeferred(entity, component);
Assert.That(component.LifeStage, Is.EqualTo(ComponentLifeStage.Stopped));
- Assert.False(entMan.EnsureComponent(entity, out var comp2));
+ Assert.That(entMan.EnsureComponent(entity, out var comp2), Is.False);
Assert.That(comp2.LifeStage, Is.LessThanOrEqualTo(ComponentLifeStage.Running));
Assert.That(component.LifeStage, Is.EqualTo(ComponentLifeStage.Deleted));
}
diff --git a/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs b/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs
index fbe135b63..cd65436c6 100644
--- a/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs
+++ b/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs
@@ -172,14 +172,14 @@ namespace Robust.UnitTesting.Shared.GameObjects.Systems
grid.SetTile(pos, new Tile(1));
var ent1 = entMan.SpawnEntity(null, coordinates);
- Assert.False(entMan.GetComponent(ent1).Anchored);
+ Assert.That(entMan.GetComponent(ent1).Anchored, Is.False);
Assert.That(!grid.GetAnchoredEntities(pos).Any());
entMan.DeleteEntity(ent1);
var ent2 = entMan.CreateEntityUninitialized(null, coordinates);
entMan.AddComponent(ent2);
entMan.InitializeAndStartEntity(ent2);
- Assert.True(entMan.GetComponent(ent2).Anchored);
+ Assert.That(entMan.GetComponent(ent2).Anchored);
Assert.That(grid.GetAnchoredEntities(pos).Count(), Is.EqualTo(1));
Assert.That(grid.GetAnchoredEntities(pos).Contains(ent2));
}
diff --git a/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs b/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs
index 45379fcd4..ea0093e2e 100644
--- a/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs
+++ b/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs
@@ -84,7 +84,7 @@ namespace Robust.UnitTesting.Shared.Input.Binding
var expectedHandlers = bkfToExpectedHandlers.Value;
HashSet returnedHandlers = registry.GetHandlers(bkf).ToHashSet();
- CollectionAssert.AreEqual(returnedHandlers, expectedHandlers);
+ Assert.That(expectedHandlers, Is.EqualTo(returnedHandlers).AsCollection);
}
// type b stuff should no longer fire
@@ -96,7 +96,7 @@ namespace Robust.UnitTesting.Shared.Input.Binding
var expectedHandlers = bkfToExpectedHandlers.Value;
expectedHandlers.RemoveAll(handler => ((TestInputCmdHandler) handler).ForType == typeof(TypeB));
HashSet returnedHandlers = registry.GetHandlers(bkf).ToHashSet();
- CollectionAssert.AreEqual(returnedHandlers, expectedHandlers);
+ Assert.That(expectedHandlers, Is.EqualTo(returnedHandlers).AsCollection);
}
}
@@ -188,7 +188,7 @@ namespace Robust.UnitTesting.Shared.Input.Binding
}
else if (returnedHandler == aHandler2)
{
- Assert.True(foundB1 && foundB2 && foundC1 && foundC2, "bind registry didn't respect" +
+ Assert.That(foundB1 && foundB2 && foundC1 && foundC2, "bind registry didn't respect" +
" handler dependency order");
}
}
@@ -198,7 +198,7 @@ namespace Robust.UnitTesting.Shared.Input.Binding
var returnedHandlerSet = new HashSet(returnedHandlers);
foreach (var expectedHandler in expectedHandlers)
{
- Assert.True(returnedHandlerSet.Contains(expectedHandler));
+ Assert.That(returnedHandlerSet.Contains(expectedHandler));
}
}
diff --git a/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs b/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs
index 04fbd4827..7729eb3d1 100644
--- a/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs
+++ b/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs
@@ -88,6 +88,7 @@ namespace Robust.UnitTesting.Shared.Maths
#endregion
+ /*
[Test]
public void EnvironmentVariablesWorkAvx()
{
@@ -99,6 +100,7 @@ namespace Robust.UnitTesting.Shared.Maths
RemoteExecutor.Invoke(() => { Assert.That(NumericsHelpers.Vector256Enabled, Is.True); },
GetInvokeOptions(true)).Dispose();
}
+ */
#region Multiply
diff --git a/Robust.UnitTesting/Shared/Networking/DisconnectTest.cs b/Robust.UnitTesting/Shared/Networking/DisconnectTest.cs
index 0cce315ec..139258362 100644
--- a/Robust.UnitTesting/Shared/Networking/DisconnectTest.cs
+++ b/Robust.UnitTesting/Shared/Networking/DisconnectTest.cs
@@ -74,7 +74,7 @@ public sealed class DisconnectTest : RobustIntegrationTest
session = sPlayerMan.Sessions.Single();
Assert.That(session.Status, Is.EqualTo(SessionStatus.Connected));
Assert.That(session.UserId, Is.EqualTo(cPlayerMan!.LocalPlayer?.UserId));
- Assert.NotNull(cPlayerMan.LocalPlayer);
+ Assert.That(cPlayerMan.LocalPlayer, Is.Not.Null);
}
void AssertDisconnected()
diff --git a/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs b/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs
index 15286f987..85510939c 100644
--- a/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs
+++ b/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs
@@ -72,7 +72,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.True(dt.Add(i), $"Add {i}");
+ Assert.That(dt.Add(i), $"Add {i}");
}
});
@@ -88,7 +88,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.True(dt.Add(i), $"Add {i}");
+ Assert.That(dt.Add(i), $"Add {i}");
}
});
@@ -96,7 +96,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.False(dt.Add(i), $"Add Dupe {i}");
+ Assert.That(dt.Add(i), Is.False, $"Add Dupe {i}");
}
});
}
@@ -110,7 +110,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.False(dt.Remove(i), $"Remove {i}");
+ Assert.That(dt.Remove(i), Is.False, $"Remove {i}");
}
});
}
@@ -124,7 +124,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.False(dt.Update(i), $"Update {i}");
+ Assert.That(dt.Update(i), Is.False, $"Update {i}");
}
});
}
@@ -138,7 +138,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.True(dt.Add(i), $"Add {i}");
+ Assert.That(dt.Add(i), $"Add {i}");
}
});
@@ -146,7 +146,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = aabbs1.Length; i < aabbs1.Length + aabbs2.Length; ++i)
{
- Assert.False(dt.Remove(i), $"Remove {i}");
+ Assert.That(dt.Remove(i), Is.False, $"Remove {i}");
}
});
}
@@ -160,14 +160,14 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.True(dt.Add(i), $"Add {i}");
+ Assert.That(dt.Add(i), $"Add {i}");
}
});
Assert.Multiple(() => {
for (var i = aabbs1.Length; i < aabbs1.Length + aabbs2.Length; ++i)
{
- Assert.False(dt.Update(i), $"Update {i}");
+ Assert.That(dt.Update(i), Is.False, $"Update {i}");
}
});
}
@@ -182,7 +182,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs.Length; ++i)
{
- Assert.True(dt.Add(i), $"Add {i}");
+ Assert.That(dt.Add(i), $"Add {i}");
}
});
aabbs = aabbs2;
@@ -191,7 +191,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs.Length; ++i)
{
- Assert.True(dt.Remove(i), $"Remove {i}");
+ Assert.That(dt.Remove(i), $"Remove {i}");
}
});
}
@@ -204,7 +204,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
for (var i = 0; i < aabbs1.Length; ++i)
{
- Assert.True(dt.Add(i), $"Add {i}");
+ Assert.That(dt.Add(i), $"Add {i}");
}
});
diff --git a/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs b/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs
index 481879b02..62bbc6926 100644
--- a/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs
+++ b/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs
@@ -60,44 +60,44 @@ namespace Robust.UnitTesting.Shared.Prototypes
var entityComponent = IoCManager.Resolve().GetComponent(entity);
Assert.That(entityComponent.Value, Is.EqualTo(5));
- Assert.False(IoCManager.Resolve().HasComponent(entity));
+ Assert.That(IoCManager.Resolve().HasComponent(entity), Is.False);
var reloaded = false;
_prototypes.PrototypesReloaded += _ => reloaded = true;
_prototypes.ReloadPrototypes(new Dictionary>());
- Assert.True(reloaded);
+ Assert.That(reloaded);
reloaded = false;
Assert.That(entityComponent.Value, Is.EqualTo(5));
- Assert.False(IoCManager.Resolve().HasComponent(entity));
+ Assert.That(IoCManager.Resolve().HasComponent(entity), Is.False);
var changedPrototypes = new Dictionary>();
_prototypes.LoadString(ReloadedPrototypes, true, changedPrototypes);
_prototypes.ReloadPrototypes(changedPrototypes);
- Assert.True(reloaded);
+ Assert.That(reloaded);
reloaded = false;
// Existing component values are not modified in the current implementation
Assert.That(entityComponent.Value, Is.EqualTo(5));
// New components are added
- Assert.True(IoCManager.Resolve().HasComponent(entity));
+ Assert.That(IoCManager.Resolve().HasComponent(entity));
changedPrototypes = new Dictionary>();
_prototypes.LoadString(InitialPrototypes, true, changedPrototypes);
_prototypes.ReloadPrototypes(changedPrototypes);
- Assert.True(reloaded);
+ Assert.That(reloaded);
reloaded = false;
// Existing component values are not modified in the current implementation
Assert.That(entityComponent.Value, Is.EqualTo(5));
// Old components are removed
- Assert.False(IoCManager.Resolve().HasComponent(entity));
+ Assert.That(IoCManager.Resolve().HasComponent(entity), Is.False);
}
}
diff --git a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs
index bcf803e0b..43c0085c1 100644
--- a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs
+++ b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs
@@ -70,7 +70,7 @@ namespace Robust.UnitTesting.Shared.Prototypes
var componentData = prototype.Components["TestBasicPrototype"].Component as TestBasicPrototypeComponent;
- Assert.NotNull(componentData);
+ Assert.That(componentData, Is.Not.Null);
Assert.That(componentData!.Str, Is.EqualTo("hi!"));
Assert.That(componentData!.int_field, Is.EqualTo(10));
Assert.That(componentData!.float_field, Is.EqualTo(10f));
diff --git a/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs b/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs
index dae97d64c..1dca766f3 100644
--- a/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs
+++ b/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs
@@ -53,7 +53,7 @@ namespace Robust.UnitTesting.Shared.Reflection
Assert.Fail("ReflectionManager returned too many types.");
}
}
- Assert.That(did1 && did2, Is.True, "IoCManager did not return both expected types. First: {0}, Second: {1}", did1, did2);
+ Assert.That(did1 && did2, Is.True, $"IoCManager did not return both expected types. First: {did1}, Second: {did2}");
}
public interface IReflectionManagerTest { }
diff --git a/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs b/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs
index a2e3a1e2b..dcf12a38f 100644
--- a/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs
+++ b/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using NUnit.Framework;
using Robust.Shared.IoC;
using Robust.Shared.Reflection;
@@ -24,7 +24,7 @@ namespace Robust.UnitTesting.Shared.Serialization
foreach (var type in types)
{
- Assert.IsTrue(Attribute.IsDefined(type, typeof(NetSerializableAttribute), true),
+ Assert.That(Attribute.IsDefined(type, typeof(NetSerializableAttribute), true),
$"{type.FullName} has {nameof(NetSerializableAttribute)}, but not the required {nameof(SerializableAttribute)}.");
}
diff --git a/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs b/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs
index 508168d04..5d2c15b18 100644
--- a/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs
+++ b/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs
@@ -32,7 +32,7 @@ namespace Robust.UnitTesting.Shared.Serialization
serializer.DeserializeDirect?>(stream, out var deserialized);
if (list == null)
{
- Assert.Null(deserialized);
+ Assert.That(deserialized, Is.Null);
}
else
{
@@ -59,7 +59,7 @@ namespace Robust.UnitTesting.Shared.Serialization
serializer.DeserializeDirect?>(stream, out var deserialized);
if (list == null)
{
- Assert.Null(deserialized);
+ Assert.That(deserialized, Is.Null);
}
else
{
@@ -85,7 +85,7 @@ namespace Robust.UnitTesting.Shared.Serialization
serializer.DeserializeDirect?>(stream, out var deserialized);
if (set == null)
{
- Assert.Null(deserialized);
+ Assert.That(deserialized, Is.Null);
}
else
{
diff --git a/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs b/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs
index 91296ec98..f57724371 100644
--- a/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs
@@ -37,13 +37,13 @@ namespace Robust.UnitTesting.Shared.Serialization
var definition = Serialization.Read(mapping, notNullableOverride: true);
- Assert.NotNull(definition);
+ Assert.That(definition, Is.Not.Null);
// Get only property with backing field, property targeted
Assert.That(definition!.GetOnlyProperty, Is.EqualTo(5));
var backingField = definition.GetType().GetBackingField(GetOnlyPropertyName);
- Assert.NotNull(backingField);
+ Assert.That(backingField, Is.Not.Null);
var backingFieldValue = backingField!.GetValue(definition);
Assert.That(backingFieldValue, Is.EqualTo(5));
@@ -61,21 +61,21 @@ namespace Robust.UnitTesting.Shared.Serialization
Assert.That(definition.GetOnlyPropertyWithOtherAttributeFieldTargeted, Is.EqualTo(25));
var property = definition.GetType().GetProperty(GetOnlyPropertyWithOtherAttributeFieldTargetedName);
- Assert.NotNull(property);
+ Assert.That(property, Is.Not.Null);
var propertyInfo = new SpecificPropertyInfo(property!);
- Assert.NotNull(propertyInfo.GetAttribute());
- Assert.NotNull(propertyInfo.GetAttribute());
+ Assert.That(propertyInfo.GetAttribute(), Is.Not.Null);
+ Assert.That(propertyInfo.GetAttribute(), Is.Not.Null);
// We check for the property info properly finding field targeted attributes as
// well, otherwise we run the risk of the data field being targeted to the
// property but an additional attribute like AlwaysPushInheritance being targeted
// to the field, as was the case in EntityPrototype.
// And I don't want to debug that ever again.
- Assert.NotNull(propertyInfo.DeclaringType);
+ Assert.That(propertyInfo.DeclaringType, Is.Not.Null);
var dataDefinition = ((SerializationManager) Serialization).GetDefinition(propertyInfo.DeclaringType!);
- Assert.NotNull(dataDefinition);
+ Assert.That(dataDefinition, Is.Not.Null);
var alwaysPushDataField = propertyInfo.GetAttribute();
var propertyDefinition =
@@ -87,26 +87,26 @@ namespace Robust.UnitTesting.Shared.Serialization
Assert.That(definition.GetOnlyPropertyFieldTargetedAndOtherAttribute, Is.EqualTo(30));
property = definition.GetType().GetProperty(GetOnlyPropertyFieldTargetedAndOtherAttributeName);
- Assert.NotNull(property);
+ Assert.That(property, Is.Not.Null);
propertyInfo = new SpecificPropertyInfo(property!);
// Data field is targeted to the backing field
- Assert.NotNull(propertyInfo.GetAttribute());
- Assert.Null(propertyInfo.GetBackingField()!.GetAttribute());
- Assert.NotNull(propertyInfo.GetAttribute(true));
+ Assert.That(propertyInfo.GetAttribute(), Is.Not.Null);
+ Assert.That(propertyInfo.GetBackingField()!.GetAttribute(), Is.Null);
+ Assert.That(propertyInfo.GetAttribute(true), Is.Not.Null);
// NeverPushInheritanceAttribute is targeted to the property
- Assert.NotNull(propertyInfo.GetAttribute());
- Assert.Null(propertyInfo.GetBackingField()!.GetAttribute());
- Assert.NotNull(propertyInfo.GetAttribute(true));
+ Assert.That(propertyInfo.GetAttribute(), Is.Not.Null);
+ Assert.That(propertyInfo.GetBackingField()!.GetAttribute(), Is.Null);
+ Assert.That(propertyInfo.GetAttribute(true), Is.Not.Null);
var neverPushDataField = propertyInfo.GetAttribute();
propertyDefinition =
dataDefinition!.BaseFieldDefinitions.Single(e => e.Attribute.Equals(neverPushDataField));
inheritanceBehaviour = propertyDefinition.InheritanceBehavior;
dataDefinition = ((SerializationManager) Serialization).GetDefinition(property!.DeclaringType!);
- Assert.NotNull(dataDefinition);
+ Assert.That(dataDefinition, Is.Not.Null);
Assert.That(inheritanceBehaviour, Is.EqualTo(InheritanceBehavior.Never));
}
diff --git a/Robust.UnitTesting/Shared/Serialization/SerializationTests/DataDefinitionTests.cs b/Robust.UnitTesting/Shared/Serialization/SerializationTests/DataDefinitionTests.cs
index 23bfec212..6030dfd10 100644
--- a/Robust.UnitTesting/Shared/Serialization/SerializationTests/DataDefinitionTests.cs
+++ b/Robust.UnitTesting/Shared/Serialization/SerializationTests/DataDefinitionTests.cs
@@ -148,7 +148,7 @@ public sealed partial class DataDefinitionTests : SerializationTest
{
var mapping = new MappingDataNode{ { fieldName, ValueDataNode.Null() } };
var res = Serialization.Read(mapping, notNullableOverride: true);
- Assert.Null(GetValue(res, fieldName));
+ Assert.That(GetValue(res, fieldName), Is.Null);
}
[TestCaseSource(nameof(AllFieldsData))]
@@ -209,8 +209,8 @@ public sealed partial class DataDefinitionTests : SerializationTest
var target = new DataDefTestDummy();
SetValue(target, fieldName, null);
Serialization.CopyTo(source, ref target, notNullableOverride: true);
- Assert.NotNull(target);
- Assert.Null(GetValue(target!, fieldName));
+ Assert.That(target, Is.Not.Null);
+ Assert.That(GetValue(target!, fieldName), Is.Null);
}
[TestCaseSource(nameof(NullableFieldsData))]
@@ -221,8 +221,8 @@ public sealed partial class DataDefinitionTests : SerializationTest
var target = new DataDefTestDummy();
SetValue(target, fieldName, altValue());
Serialization.CopyTo(source, ref target, notNullableOverride: true);
- Assert.NotNull(target);
- Assert.Null(GetValue(target!, fieldName));
+ Assert.That(target, Is.Not.Null);
+ Assert.That(GetValue(target!, fieldName), Is.Null);
}
[TestCaseSource(nameof(NullableFieldsData))]
@@ -233,7 +233,7 @@ public sealed partial class DataDefinitionTests : SerializationTest
var target = new DataDefTestDummy();
SetValue(target, fieldName, null);
Serialization.CopyTo(source, ref target, notNullableOverride: true);
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
Assert.That(GetValue(target!, fieldName), Is.EqualTo(value()));
}
@@ -245,7 +245,7 @@ public sealed partial class DataDefinitionTests : SerializationTest
var target = new DataDefTestDummy();
SetValue(target, fieldName, altValue());
Serialization.CopyTo(source, ref target, notNullableOverride: true);
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
Assert.That(GetValue(target!, fieldName), Is.EqualTo(value()));
}
@@ -283,7 +283,7 @@ public sealed partial class DataDefinitionTests : SerializationTest
var target = new DataDefTestDummy();
SetValue(target, fieldName, null);
Serialization.CopyTo(source, ref target, notNullableOverride: true);
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
Assert.That(GetValue(target!, fieldName), Is.EqualTo(value()));
}
@@ -295,7 +295,7 @@ public sealed partial class DataDefinitionTests : SerializationTest
var target = new DataDefTestDummy();
SetValue(target, fieldName, altValue());
Serialization.CopyTo(source, ref target, notNullableOverride: true);
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
Assert.That(GetValue(target!, fieldName), Is.EqualTo(value()));
}
}
diff --git a/Robust.UnitTesting/Shared/Serialization/SerializationTests/ManagerTests.cs b/Robust.UnitTesting/Shared/Serialization/SerializationTests/ManagerTests.cs
index eefd782bb..ad4dce76d 100644
--- a/Robust.UnitTesting/Shared/Serialization/SerializationTests/ManagerTests.cs
+++ b/Robust.UnitTesting/Shared/Serialization/SerializationTests/ManagerTests.cs
@@ -321,21 +321,21 @@ public sealed partial class ManagerTests : SerializationTest
public void Read_NT_NV_Struct(DataNode _, Func __, Func ___, bool useContext, object[] ____) where T : struct
{
var val = Serialization.Read(ValueDataNode.Null(), context: Context(useContext));
- Assert.Null(val);
+ Assert.That(val, Is.Null);
}
[TestCaseSource(nameof(ReadWriteTypesClass))]
public void Read_NT_NV_Class(DataNode _, Func __, Func ___, bool useContext, object[] ____) where T : class
{
var val = Serialization.Read(ValueDataNode.Null(), context: Context(useContext));
- Assert.Null(val);
+ Assert.That(val, Is.Null);
}
[TestCaseSource(nameof(ReadWriteTypesStruct))]
public void Read_NT_RV_Struct(DataNode node, Func value, Func _, bool useContext, object[] valueExtractors) where T : struct
{
var val = Serialization.Read(node, context: Context(useContext));
- Assert.NotNull(val);
+ Assert.That(val, Is.Not.Null);
AssertEqual(val!.Value, value(), valueExtractors);
}
@@ -343,7 +343,7 @@ public sealed partial class ManagerTests : SerializationTest
public void Read_NT_RV_Class(DataNode node, Func value, Func _, bool useContext, object[] valueExtractors) where T : class
{
var val = Serialization.Read(node, context: Context(useContext));
- Assert.NotNull(val);
+ Assert.That(val, Is.Not.Null);
AssertEqual(val!, value(), valueExtractors);
}
@@ -371,7 +371,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = null;
Serialization.CopyTo(null, ref target, context: Context(useContext));
- Assert.Null(target);
+ Assert.That(target, Is.Null);
}
[TestCaseSource(nameof(TestableTypesClass))]
@@ -380,7 +380,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = null;
Serialization.CopyTo(null, ref target, context: Context(useContext));
- Assert.Null(target);
+ Assert.That(target, Is.Null);
}
[TestCaseSource(nameof(TestableTypesStruct))]
@@ -389,7 +389,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = value();
Serialization.CopyTo(null, ref target, context: Context(useContext));
- Assert.Null(target);
+ Assert.That(target, Is.Null);
}
[TestCaseSource(nameof(TestableTypesClass))]
@@ -398,7 +398,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = value();
Serialization.CopyTo(null, ref target, context: Context(useContext));
- Assert.Null(target);
+ Assert.That(target, Is.Null);
}
[TestCaseSource(nameof(TestableTypesStruct))]
@@ -407,7 +407,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = null;
Serialization.CopyTo(value(), ref target, context: Context(useContext));
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
AssertEqual(target!.Value, value(), valueExtractors);
}
@@ -417,7 +417,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = null;
Serialization.CopyTo(value(), ref target, context: Context(useContext));
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
AssertEqual(target!, value(), valueExtractors);
}
@@ -427,7 +427,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = altValue();
Serialization.CopyTo(value(), ref target, context: Context(useContext));
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
AssertEqual(target!.Value, value(), valueExtractors);
}
@@ -437,7 +437,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T? target = altValue();
Serialization.CopyTo(value(), ref target, context: Context(useContext));
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
AssertEqual(target!, value(), valueExtractors);
}
@@ -466,7 +466,7 @@ public sealed partial class ManagerTests : SerializationTest
{
T target = null!;
Serialization.CopyTo(value(), ref target, context: Context(useContext));
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
AssertEqual(target!, value(), valueExtractors);
}
@@ -488,7 +488,7 @@ public sealed partial class ManagerTests : SerializationTest
object[] valueExtractors) where T : struct
{
var copy = Serialization.CreateCopy(null, context: Context(useContext));
- Assert.Null(copy);
+ Assert.That(copy, Is.Null);
}
[TestCaseSource(nameof(TestableTypesClass))]
@@ -496,7 +496,7 @@ public sealed partial class ManagerTests : SerializationTest
object[] valueExtractors) where T : class
{
var copy = Serialization.CreateCopy(null, context: Context(useContext));
- Assert.Null(copy);
+ Assert.That(copy, Is.Null);
}
[TestCaseSource(nameof(TestableTypesAll))]
@@ -504,7 +504,7 @@ public sealed partial class ManagerTests : SerializationTest
object[] valueExtractors)
{
var copy = Serialization.CreateCopy(value(), context: Context(useContext));
- Assert.NotNull(copy);
+ Assert.That(copy, Is.Not.Null);
AssertEqual(copy!, value(), valueExtractors);
}
@@ -536,7 +536,7 @@ public sealed partial class ManagerTests : SerializationTest
CopyByRefTestClass target = null!;
var source = new CopyByRefTestClass();
Serialization.CopyTo(source, ref target, notNullableOverride: true);
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
Assert.That(target!, Is.SameAs(source));
}
@@ -545,7 +545,7 @@ public sealed partial class ManagerTests : SerializationTest
{
CopyByRefTestClass? target = null;
Serialization.CopyTo(null, ref target);
- Assert.Null(target);
+ Assert.That(target, Is.Null);
}
[Test]
@@ -560,7 +560,7 @@ public sealed partial class ManagerTests : SerializationTest
public void CreateCopy_CopyByRef_NV_Class()
{
var copy = Serialization.CreateCopy(null);
- Assert.Null(copy);
+ Assert.That(copy, Is.Null);
}
[Test]
@@ -569,7 +569,7 @@ public sealed partial class ManagerTests : SerializationTest
CopyByRefTestStruct? target = null;
var source = new CopyByRefTestStruct{ID = 5};
Serialization.CopyTo(source, ref target);
- Assert.NotNull(target);
+ Assert.That(target, Is.Not.Null);
Assert.That(target!.Value.ID, Is.EqualTo(source.ID));
}
@@ -578,7 +578,7 @@ public sealed partial class ManagerTests : SerializationTest
{
CopyByRefTestStruct? target = null;
Serialization.CopyTo(null, ref target);
- Assert.Null(target);
+ Assert.That(target, Is.Null);
}
[Test]
@@ -593,7 +593,7 @@ public sealed partial class ManagerTests : SerializationTest
public void CreateCopy_CopyByRef_NV_Struct()
{
var copy = Serialization.CreateCopy(null);
- Assert.Null(copy);
+ Assert.That(copy, Is.Null);
}
#endregion
diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs
index cdeab9532..5dd8beac5 100644
--- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs
@@ -30,7 +30,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers
var node = Serialization.WriteValueAs(registry);
Assert.That(node.Sequence.Count, Is.EqualTo(1));
- Assert.IsInstanceOf(node[0]);
+ Assert.That(node[0], Is.InstanceOf());
var mapping = node.Cast(0);
Assert.That(mapping.Cast("type").Value, Is.EqualTo("Test"));
@@ -49,7 +49,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers
Assert.That(deserializedRegistry.Count, Is.EqualTo(1));
Assert.That(deserializedRegistry.ContainsKey("Test"));
- Assert.IsInstanceOf(deserializedRegistry["Test"].Component);
+ Assert.That(deserializedRegistry["Test"].Component, Is.InstanceOf());
}
}
diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/AbstractDictionarySerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/AbstractDictionarySerializerTest.cs
index 8da724e40..f09235695 100644
--- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/AbstractDictionarySerializerTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/AbstractDictionarySerializerTest.cs
@@ -46,7 +46,7 @@ SealedTestTypeB:
MappingDataNode,
AbstractDictionarySerializer>
(node, notNullableOverride:true);
- Assert.NotNull(data);
+ Assert.That(data, Is.Not.Null);
Assert.That(data.Count, Is.EqualTo(2));
Assert.That(data.ContainsKey(typeof(SealedTestTypeA)));
Assert.That(data.ContainsKey(typeof(SealedTestTypeB)));
@@ -54,8 +54,8 @@ SealedTestTypeB:
var a = data[typeof(SealedTestTypeA)] as SealedTestTypeA;
var b = data[typeof(SealedTestTypeB)] as SealedTestTypeB;
- Assert.NotNull(a);
- Assert.NotNull(b);
+ Assert.That(a, Is.Not.Null);
+ Assert.That(b, Is.Not.Null);
Assert.That(a!.X, Is.EqualTo(1));
Assert.That(a.Y, Is.EqualTo(2));
@@ -66,7 +66,7 @@ SealedTestTypeB:
AbstractDictionarySerializer>
(data, notNullableOverride:true);
- Assert.Null(node.Except(newNode));
+ Assert.That(node.Except(newNode), Is.Null);
validation = seri.ValidateNode,
MappingDataNode,
AbstractDictionarySerializer>
diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs
index 5bcbec903..d01a6ca21 100644
--- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs
@@ -90,7 +90,7 @@ entitiesImmutableList:
var node = stream.Documents[0].RootNode.ToDataNode();
var definition = Serialization.Read(node, notNullableOverride: true);
- Assert.NotNull(definition);
+ Assert.That(definition, Is.Not.Null);
Assert.That(definition!.EntitiesList.Count, Is.EqualTo(1));
Assert.That(definition.EntitiesList[0], Is.EqualTo(TestEntityId));
@@ -111,16 +111,16 @@ entitiesImmutableList:
var validSequence = new SequenceDataNode(TestEntityId);
var validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(validSequence);
- Assert.True(validations.Valid);
+ Assert.That(validations.Valid);
validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(validSequence);
- Assert.True(validations.Valid);
+ Assert.That(validations.Valid);
validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(validSequence);
- Assert.True(validations.Valid);
+ Assert.That(validations.Valid);
validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(validSequence);
- Assert.True(validations.Valid);
+ Assert.That(validations.Valid);
}
[Test]
@@ -129,16 +129,16 @@ entitiesImmutableList:
var invalidSequence = new SequenceDataNode(TestInvalidEntityId);
var validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(invalidSequence);
- Assert.False(validations.Valid);
+ Assert.That(validations.Valid, Is.False);
validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(invalidSequence);
- Assert.False(validations.Valid);
+ Assert.That(validations.Valid, Is.False);
validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(invalidSequence);
- Assert.False(validations.Valid);
+ Assert.That(validations.Valid, Is.False);
validations = Serialization.ValidateNode, SequenceDataNode, PrototypeIdListSerializer>(invalidSequence);
- Assert.False(validations.Valid);
+ Assert.That(validations.Valid, Is.False);
}
}
diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs
index f42b7cb19..53563e69f 100644
--- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs
@@ -1,4 +1,4 @@
-using NUnit.Framework;
+using NUnit.Framework;
using Robust.Shared.Serialization.Markdown.Value;
// ReSharper disable AccessToStaticMemberViaDerivedType
@@ -13,7 +13,6 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers
{
var value = Serialization.Read(new ValueDataNode("5"));
- Assert.NotNull(value);
Assert.That(value, Is.EqualTo(5));
}
@@ -22,7 +21,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers
{
var nullValue = Serialization.Read(ValueDataNode.Null());
- Assert.Null(nullValue);
+ Assert.That(nullValue, Is.Null);
var value = Serialization.Read(new ValueDataNode("5"));
diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs
index a1277e9cb..c2eb911eb 100644
--- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using NUnit.Framework;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Serialization.Markdown.Sequence;
@@ -41,8 +41,8 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers
var result = Serialization.Read, SequenceDataNode, ListSerializers>(node, notNullableOverride: true);
var list = (List?) result;
- Assert.NotNull(list);
- Assert.IsNotEmpty(list!);
+ Assert.That(list, Is.Not.Null);
+ Assert.That(list!, Is.Not.Empty);
Assert.That(list, Has.Count.EqualTo(2));
Assert.That(list, Does.Contain("A"));
Assert.That(list, Does.Contain("E"));
@@ -66,15 +66,15 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers
var source = new List {"A", "E"};
var target = new List();
- Assert.IsNotEmpty(source);
- Assert.IsEmpty(target);
+ Assert.That(source, Is.Not.Empty);
+ Assert.That(target, Is.Empty);
Serialization.CopyTo, ListSerializers>(source, ref target, notNullableOverride: true);
- Assert.NotNull(source);
+ Assert.That(source, Is.Not.Null);
- Assert.IsNotEmpty(source);
- Assert.IsNotEmpty(target!);
+ Assert.That(source, Is.Not.Empty);
+ Assert.That(target!, Is.Not.Empty);
Assert.That(source, Is.EqualTo(target));
diff --git a/Robust.UnitTesting/Shared/Serialization/VirtualObjectArrayTest.cs b/Robust.UnitTesting/Shared/Serialization/VirtualObjectArrayTest.cs
index 93b3a8775..c2dc599e9 100644
--- a/Robust.UnitTesting/Shared/Serialization/VirtualObjectArrayTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/VirtualObjectArrayTest.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using NUnit.Framework;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.Markdown.Mapping;
@@ -45,7 +45,7 @@ public sealed partial class VirtualObjectArrayTest : SerializationTest
// Check that the yaml doesn't differ in any way.
var diff = newSquence.Except(sequence);
- Assert.IsNull(diff);
+ Assert.That(diff, Is.Null);
// And finally, double check that the serialized data can be re-deserialized (dataNode.Except isn't perfect).
arr = Serialization.Read(newSquence, notNullableOverride: true);
@@ -64,7 +64,7 @@ public sealed partial class VirtualObjectArrayTest : SerializationTest
var newSquence = Serialization.WriteValue(list, notNullableOverride: true);
var diff = newSquence.Except(sequence);
- Assert.IsNull(diff);
+ Assert.That(diff, Is.Null);
list = Serialization.Read>(sequence, notNullableOverride: true);
Assert.That(list[0], Is.TypeOf(typeof(SealedTestDataDef)));
@@ -90,10 +90,10 @@ public sealed partial class VirtualObjectArrayTest : SerializationTest
// The old sequence will now differ as it should not write the redundant !type tag
var newSquence = Serialization.WriteValue(virtArr, notNullableOverride: true);
var diff = newSquence.Except(sequence);
- Assert.NotNull(diff);
+ Assert.That(diff, Is.Not.Null);
diff = newSquence.Except(expectedSequence);
- Assert.IsNull(diff);
+ Assert.That(diff, Is.Null);
virtArr = Serialization.Read(newSquence, notNullableOverride: true);
Assert.That(virtArr[0], Is.TypeOf(typeof(VirtualTestDataDef)));
@@ -108,10 +108,10 @@ public sealed partial class VirtualObjectArrayTest : SerializationTest
var newSquence = Serialization.WriteValue(virtList, notNullableOverride: true);
var diff = newSquence.Except(sequence);
- Assert.NotNull(diff);
+ Assert.That(diff, Is.Not.Null);
diff = newSquence.Except(expectedSequence);
- Assert.IsNull(diff);
+ Assert.That(diff, Is.Null);
virtList = Serialization.Read>(newSquence, notNullableOverride: true);
Assert.That(virtList[0], Is.TypeOf(typeof(VirtualTestDataDef)));
diff --git a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs
index 31526159e..33bb917f6 100644
--- a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs
+++ b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs
@@ -7,6 +7,7 @@ using Robust.Shared.Serialization.Markdown;
using Robust.Shared.Serialization.Markdown.Mapping;
using Robust.Shared.Serialization.Markdown.Sequence;
using Robust.Shared.Utility;
+using YamlDotNet.Core;
using YamlDotNet.RepresentationModel;
// ReSharper disable AccessToStaticMemberViaDerivedType
@@ -65,13 +66,12 @@ namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests
{
var document = new YamlDocument(root.ToYamlNode());
- using var stream = new MemoryStream();
- using var writer = new StreamWriter(stream) {NewLine = "\n"};
+ using var writer = new StringWriter();
var yamlStream = new YamlStream(document);
- yamlStream.Save(writer);
+ yamlStream.Save(new Emitter(writer, new EmitterSettings().WithNewLine("\n")), true);
writer.Flush();
- return EncodingHelpers.UTF8.GetString(stream.ToArray());
+ return writer.ToString();
}
// deserializes yaml text, loads the first document, and returns the first entity
diff --git a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs
index 739eb6533..3fc1988fc 100644
--- a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs
+++ b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs
@@ -34,13 +34,13 @@ namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests
var serMan = IoCManager.Resolve();
var mapping = (MappingDataNode) serMan.WriteValue(type, notNullableOverride: true);
- Assert.IsNotEmpty(mapping.Children);
+ Assert.That(mapping.Children, Is.Not.Empty);
var testPropertyOne = mapping.Get("testPropertyOne") as ValueDataNode;
var testPropertyTwo = mapping.Get("testPropertyTwo") as ValueDataNode;
- Assert.NotNull(testPropertyOne);
- Assert.NotNull(testPropertyTwo);
+ Assert.That(testPropertyOne, Is.Not.Null);
+ Assert.That(testPropertyTwo, Is.Not.Null);
Assert.That(testPropertyOne!.Value, Is.EqualTo("B"));
Assert.That(testPropertyTwo!.Value, Is.EqualTo("10"));
}
@@ -71,8 +71,8 @@ namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests
var serMan = IoCManager.Resolve();
var type = serMan.Read(mapping["test"].ToDataNode(), notNullableOverride: true);
- Assert.NotNull(type);
- Assert.IsInstanceOf(type);
+ Assert.That(type, Is.Not.Null);
+ Assert.That(type, Is.InstanceOf());
var testTypeTwo = (TestTypeTwo) type!;
diff --git a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs
index ce88c0edd..4ddbd894f 100644
--- a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs
+++ b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs
@@ -1,4 +1,4 @@
-using System.IO;
+using System.IO;
using NUnit.Framework;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
@@ -27,7 +27,7 @@ namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests
var serMan = IoCManager.Resolve();
var mapping = serMan.WriteValue(type, notNullableOverride: true);
- Assert.IsInstanceOf(mapping);
+ Assert.That(mapping, Is.InstanceOf());
var scalar = (MappingDataNode) mapping;
@@ -58,8 +58,8 @@ test:
var serMan = IoCManager.Resolve();
var type = serMan.Read(new MappingDataNode(mapping)["test"], notNullableOverride: true);
- Assert.NotNull(type);
- Assert.IsInstanceOf(type);
+ Assert.That(type, Is.Not.Null);
+ Assert.That(type, Is.InstanceOf());
}
}
diff --git a/Robust.UnitTesting/Shared/Spawning/SpawnInContainerOrDropTest.cs b/Robust.UnitTesting/Shared/Spawning/SpawnInContainerOrDropTest.cs
index 6a5423500..e2b12d3a3 100644
--- a/Robust.UnitTesting/Shared/Spawning/SpawnInContainerOrDropTest.cs
+++ b/Robust.UnitTesting/Shared/Spawning/SpawnInContainerOrDropTest.cs
@@ -112,8 +112,8 @@ public sealed class SpawnInContainerOrDropTest : EntitySpawnHelpersTest
var xform = EntMan.GetComponent(uid);
Assert.That(xform.ParentUid, Is.EqualTo(EntityUid.Invalid));
Assert.That(xform.MapID, Is.EqualTo(MapId.Nullspace));
- Assert.Null(xform.MapUid);
- Assert.Null(xform.GridUid);
+ Assert.That(xform.MapUid, Is.Null);
+ Assert.That(xform.GridUid, Is.Null);
});
await Server.WaitPost(() =>MapMan.DeleteMap(MapId));
diff --git a/Robust.UnitTesting/Shared/Spawning/SpawnNextToOrDropTest.cs b/Robust.UnitTesting/Shared/Spawning/SpawnNextToOrDropTest.cs
index 5a7e4c043..fa1cd9f4b 100644
--- a/Robust.UnitTesting/Shared/Spawning/SpawnNextToOrDropTest.cs
+++ b/Robust.UnitTesting/Shared/Spawning/SpawnNextToOrDropTest.cs
@@ -103,8 +103,8 @@ public sealed class SpawnNextToOrDropTest : EntitySpawnHelpersTest
var xform = EntMan.GetComponent(uid);
Assert.That(xform.ParentUid, Is.EqualTo(EntityUid.Invalid));
Assert.That(xform.MapID, Is.EqualTo(MapId.Nullspace));
- Assert.Null(xform.MapUid);
- Assert.Null(xform.GridUid);
+ Assert.That(xform.MapUid, Is.Null);
+ Assert.That(xform.GridUid, Is.Null);
});
await Server.WaitPost(() =>MapMan.DeleteMap(MapId));
diff --git a/Robust.UnitTesting/Shared/Toolshed/ToolshedTest.cs b/Robust.UnitTesting/Shared/Toolshed/ToolshedTest.cs
index daf4e8846..e0c488c33 100644
--- a/Robust.UnitTesting/Shared/Toolshed/ToolshedTest.cs
+++ b/Robust.UnitTesting/Shared/Toolshed/ToolshedTest.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
@@ -29,11 +29,12 @@ public abstract class ToolshedTest : RobustIntegrationTest, IInvocationContext
public async Task TearDownInternal()
{
await TearDown();
+ Server.Dispose();
}
protected virtual async Task TearDown()
{
- Assert.IsEmpty(_expectedErrors);
+ Assert.That(_expectedErrors, Is.Empty);
ClearErrors();
}
diff --git a/Robust.UnitTesting/Shared/TransformTests/GridTraversalTest.cs b/Robust.UnitTesting/Shared/TransformTests/GridTraversalTest.cs
index b6001f9f6..c14761e49 100644
--- a/Robust.UnitTesting/Shared/TransformTests/GridTraversalTest.cs
+++ b/Robust.UnitTesting/Shared/TransformTests/GridTraversalTest.cs
@@ -69,19 +69,19 @@ public sealed class GridTraversalTest : RobustIntegrationTest
// Spawning an entity far away from the grid will leave it parented to the map.
entity = sEntMan.SpawnEntity(null, new MapCoordinates(new Vector2(100f, 100f), mapId));
Assert.That(sEntMan.GetComponent(entity).MapUid, Is.EqualTo(map));
- Assert.Null(sEntMan.GetComponent(entity).GridUid);
+ Assert.That(sEntMan.GetComponent(entity).GridUid, Is.Null);
Assert.That(sEntMan.GetComponent(entity).ParentUid, Is.EqualTo(map));
sEntMan.Deleted(entity);
entity = sEntMan.SpawnEntity(null, new EntityCoordinates(map, new Vector2(100f, 100f)));
Assert.That(sEntMan.GetComponent(entity).MapUid, Is.EqualTo(map));
- Assert.Null(sEntMan.GetComponent(entity).GridUid);
+ Assert.That(sEntMan.GetComponent(entity).GridUid, Is.Null);
Assert.That(sEntMan.GetComponent(entity).ParentUid, Is.EqualTo(map));
sEntMan.Deleted(entity);
entity = sEntMan.SpawnEntity(null, new EntityCoordinates(grid, 100f, 100f));
Assert.That(sEntMan.GetComponent(entity).MapUid, Is.EqualTo(map));
- Assert.Null(sEntMan.GetComponent(entity).GridUid);
+ Assert.That(sEntMan.GetComponent(entity).GridUid, Is.Null);
Assert.That(sEntMan.GetComponent(entity).ParentUid, Is.EqualTo(map));
sEntMan.Deleted(entity);
});
diff --git a/Robust.UnitTesting/Shared/Utility/ResPathTest.cs b/Robust.UnitTesting/Shared/Utility/ResPathTest.cs
index 250b56196..e007730b5 100644
--- a/Robust.UnitTesting/Shared/Utility/ResPathTest.cs
+++ b/Robust.UnitTesting/Shared/Utility/ResPathTest.cs
@@ -208,7 +208,7 @@ public sealed class ResPathTest
Assert.That(empty?.Extension, Is.EqualTo(""));
Assert.That(empty?.Filename, Is.EqualTo("."));
Assert.That(empty?.FilenameWithoutExtension, Is.EqualTo("."));
- Assert.False(empty.Equals(null));
+ Assert.That(empty.Equals(null), Is.False);
}
[Test]
diff --git a/RobustToolbox.sln b/RobustToolbox.sln
index 2a9941161..43580afda 100644
--- a/RobustToolbox.sln
+++ b/RobustToolbox.sln
@@ -23,8 +23,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetSerializer", "NetSeriali
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetSerializer", "NetSerializer\NetSerializer\NetSerializer.csproj", "{ECBCE1D8-05C2-4881-9446-197C4C8E1C14}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Physics", "Robust.Physics\Robust.Physics.csproj", "{887A54FA-7D31-4D6D-9D7F-9AE3739E4982}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Robust.LoaderApi", "Robust.LoaderApi", "{805C8FD2-0C32-4DA8-BC4B-143BA5D48FF4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.LoaderApi", "Robust.LoaderApi\Robust.LoaderApi\Robust.LoaderApi.csproj", "{4FC5049F-AEEC-4DC0-9F4D-EB927AAB4F15}"
@@ -135,14 +133,6 @@ Global
{ECBCE1D8-05C2-4881-9446-197C4C8E1C14}.Release|Any CPU.Build.0 = Release|Any CPU
{ECBCE1D8-05C2-4881-9446-197C4C8E1C14}.Release|x64.ActiveCfg = Release|Any CPU
{ECBCE1D8-05C2-4881-9446-197C4C8E1C14}.Release|x64.Build.0 = Release|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Debug|x64.ActiveCfg = Debug|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Debug|x64.Build.0 = Debug|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Release|Any CPU.Build.0 = Release|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Release|x64.ActiveCfg = Release|Any CPU
- {887A54FA-7D31-4D6D-9D7F-9AE3739E4982}.Release|x64.Build.0 = Release|Any CPU
{4FC5049F-AEEC-4DC0-9F4D-EB927AAB4F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FC5049F-AEEC-4DC0-9F4D-EB927AAB4F15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FC5049F-AEEC-4DC0-9F4D-EB927AAB4F15}.Debug|x64.ActiveCfg = Debug|Any CPU
diff --git a/nuget.config b/nuget.config
index 09f4cb662..9e5b0064c 100644
--- a/nuget.config
+++ b/nuget.config
@@ -1,7 +1,15 @@
-
+
+
+
+
+
+
+
+
+