mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
Replaced `Assert.Multiple` with `using (Assert.EnterMultipleScope())` in various test methods across multiple test classes. This change improves the readability and structure of assertions, allowing for better management of multiple assertions within a single test case. Affected classes include `AssetResolutionTests`, `FileResolutionTests`, `PPtrTests`, `SmartStreamTests`, and others, enhancing the organization of test result outputs.
121 lines
2.6 KiB
C#
121 lines
2.6 KiB
C#
using AssetRipper.Assets.Metadata;
|
|
|
|
namespace AssetRipper.Assets.Tests;
|
|
|
|
public class PPtrTests
|
|
{
|
|
[Test]
|
|
public void PPtr_ReturnsCorrectValues()
|
|
{
|
|
// Arrange
|
|
int fileID = 1;
|
|
long pathID = 2;
|
|
|
|
// Act
|
|
PPtr pptr = new PPtr(fileID, pathID);
|
|
|
|
// Assert
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(pptr.FileID, Is.EqualTo(fileID));
|
|
Assert.That(pptr.PathID, Is.EqualTo(pathID));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void PPtr_ImplicitOperator_ReturnsCorrectType()
|
|
{
|
|
// Arrange
|
|
int fileID = 1;
|
|
long pathID = 2;
|
|
PPtr<IUnityObjectBase> pptr = new PPtr<IUnityObjectBase>(fileID, pathID);
|
|
|
|
// Act
|
|
PPtr convertedPptr = pptr;
|
|
|
|
// Assert
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(convertedPptr.FileID, Is.EqualTo(fileID));
|
|
Assert.That(convertedPptr.PathID, Is.EqualTo(pathID));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void PPtrT_ReturnsCorrectValues()
|
|
{
|
|
// Arrange
|
|
int fileID = 1;
|
|
long pathID = 2;
|
|
|
|
// Act
|
|
PPtr<IDerivedUnityObjectInterface> pptr = new PPtr<IDerivedUnityObjectInterface>(fileID, pathID);
|
|
|
|
// Assert
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(pptr.FileID, Is.EqualTo(fileID));
|
|
Assert.That(pptr.PathID, Is.EqualTo(pathID));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void PPtrT_ExplicitOperator_ReturnsCorrectType()
|
|
{
|
|
// Arrange
|
|
int fileID = 1;
|
|
long pathID = 2;
|
|
PPtr<IUnityObjectBase> pptr = new PPtr<IUnityObjectBase>(fileID, pathID);
|
|
|
|
// Act
|
|
PPtr<IDerivedUnityObjectInterface> convertedPptr = (PPtr<IDerivedUnityObjectInterface>)pptr;
|
|
|
|
// Assert
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(convertedPptr.FileID, Is.EqualTo(fileID));
|
|
Assert.That(convertedPptr.PathID, Is.EqualTo(pathID));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void PPtrT_ImplicitOperator_ReturnsCorrectType()
|
|
{
|
|
// Arrange
|
|
int fileID = 1;
|
|
long pathID = 2;
|
|
PPtr<IDerivedUnityObjectInterface> pptr = new PPtr<IDerivedUnityObjectInterface>(fileID, pathID);
|
|
|
|
// Act
|
|
PPtr<IUnityObjectBase> convertedPptr = pptr;
|
|
|
|
// Assert
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(convertedPptr.FileID, Is.EqualTo(fileID));
|
|
Assert.That(convertedPptr.PathID, Is.EqualTo(pathID));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void PPtrT_ExplicitOperator_FromIUnityObjectBase_ReturnsCorrectType()
|
|
{
|
|
// Arrange
|
|
int fileID = 1;
|
|
long pathID = 2;
|
|
PPtr<IUnityObjectBase> pptr = new PPtr<IUnityObjectBase>(fileID, pathID);
|
|
|
|
// Act
|
|
PPtr<IDerivedUnityObjectInterface> convertedPptr = (PPtr<IDerivedUnityObjectInterface>)pptr;
|
|
|
|
// Assert
|
|
using (Assert.EnterMultipleScope())
|
|
{
|
|
Assert.That(convertedPptr.FileID, Is.EqualTo(fileID));
|
|
Assert.That(convertedPptr.PathID, Is.EqualTo(pathID));
|
|
}
|
|
}
|
|
|
|
private interface IDerivedUnityObjectInterface : IUnityObjectBase { }
|
|
}
|