Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Testing/CASLTests/CASLTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
9 changes: 5 additions & 4 deletions Testing/CASLTests/NativeInterop/ExtensionMethodTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace CASLTests.NativeInterop;
using System;
using System.Runtime.InteropServices;
using CASL.NativeInterop;
using FluentAssertions;
using Xunit;

public class ExtensionMethodTests
Expand All @@ -19,21 +20,21 @@ public void ToManagedUTF8String_WithNullPointer_ReturnsEmptyString()
var actual = IntPtr.Zero.ToManagedUtf8String();

// Assert
Assert.Equal(string.Empty, actual);
actual.Should().BeEmpty();
}

[Fact]
public void ToManagedUTF8String_WhenInvoked_ReturnsCorrectResult()
{
// Arrange
var testString = "hello world";
const string testString = "hello world";
var stringDataPtr = Marshal.StringToHGlobalAnsi(testString);

// Act
var actual = stringDataPtr.ToManagedUtf8String();

// Assert
Assert.Equal("hello world", actual);
actual.Should().Be("hello world");
}

[Fact]
Expand All @@ -46,7 +47,7 @@ public void ToReadOnlyCollection_WhenInvoked_ReturnsCorrectResult()
var actual = testItems.ToReadOnlyCollection();

// Assert
Assert.Equal(new[] { "item-1", "item-2" }, actual);
actual.Should().BeEquivalentTo("item-1", "item-2");
}
#endregion
}
17 changes: 9 additions & 8 deletions Testing/CASLTests/OpenAL/ALContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace CASLTests.OpenAL;

using CASL.OpenAL;
using FluentAssertions;
using Xunit;

/// <summary>
Expand All @@ -23,7 +24,7 @@ public void Ctr_WhenInvoked_SetHandleProperty()
var context = new ALContext(handle);

// Assert
Assert.Equal(1234, context.Handle);
context.Handle.Should().Be(1234);
}
#endregion

Expand All @@ -39,7 +40,7 @@ public void ImplicitCast_WhenInvoked_SuccessfullyCastsContextToPointer()
nint actual = context;

// Assert
Assert.Equal(1234, actual);
actual.Should().Be(1234);
}

[Fact]
Expand All @@ -53,7 +54,7 @@ public void EqualsOperator_WithEqualOperands_ReturnsTrue()
var actual = left == right;

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}

[Fact]
Expand All @@ -67,7 +68,7 @@ public void NotEqualsOperator_WithNonEqualOperands_ReturnsFalse()
var actual = left != right;

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}
#endregion

Expand All @@ -79,7 +80,7 @@ public void Null_WhenInvoked_ReturnsEmptyContext()
var actual = ALContext.Null();

// Assert
Assert.Equal(0, actual.Handle);
actual.Handle.Should().Be(0);
}

[Fact]
Expand All @@ -93,7 +94,7 @@ public void Equals_WithContextParamOverloadAndEqualContext_ReturnsTrue()
var actual = contextA.Equals(contextB);

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}

[Fact]
Expand All @@ -107,7 +108,7 @@ public void Equals_WithObjectParamOverloadAndNonContextType_ReturnsFalse()
var actual = contextA.Equals(contextB);

// Assert
Assert.False(actual);
actual.Should().BeFalse();
}

[Fact]
Expand All @@ -121,7 +122,7 @@ public void Equals_WithObjectParamOverloadAndEqualContext_ReturnsTrue()
var actual = contextA.Equals(contextB);

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}
#endregion
}
11 changes: 6 additions & 5 deletions Testing/CASLTests/OpenAL/ALDeviceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace CASLTests.OpenAL;

using CASL.OpenAL;
using FluentAssertions;
using Xunit;

/// <summary>
Expand Down Expand Up @@ -53,7 +54,7 @@ public void EqualsOperator_WithEqualOperands_ReturnsTrue()
var actual = left == right;

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}

[Fact]
Expand All @@ -67,7 +68,7 @@ public void NotEqualsOperator_WithNonEqualOperands_ReturnsFalse()
var actual = left != right;

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}
#endregion

Expand All @@ -93,7 +94,7 @@ public void Equals_WithDeviceParamOverloadAndEquALDevice_ReturnsTrue()
var actual = deviceA.Equals(deviceB);

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}

[Fact]
Expand All @@ -107,7 +108,7 @@ public void Equals_WithObjectParamOverloadAndNonDeviceType_ReturnsFalse()
var actual = deviceA.Equals(deviceB);

// Assert
Assert.False(actual);
actual.Should().BeFalse();
}

[Fact]
Expand All @@ -121,7 +122,7 @@ public void Equals_WithObjectParamOverloadAndEquALDevice_ReturnsTrue()
var actual = deviceA.Equals(deviceB);

// Assert
Assert.True(actual);
actual.Should().BeTrue();
}
#endregion
}
Loading