//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Tests.Offline;
using MUnique.OpenMU.GameLogic;
using MUnique.OpenMU.GameLogic.Offline;
///
/// Tests for .
///
[TestFixture]
public class OfflinePlayerMuHelperTests
{
private IGameContext _gameContext = null!;
///
/// Sets up a fresh game context before each test.
///
[SetUp]
public void SetUp()
{
this._gameContext = GameContextTestHelper.CreateGameContext();
}
///
/// Tests that the intelligence can be created and started.
///
[Test]
public async ValueTask StartsWithoutExceptionAsync()
{
// Arrange
var player = await this.CreateOfflinePlayerAsync().ConfigureAwait(false);
// Act
var intelligence = new OfflinePlayerMuHelper(player);
intelligence.Start();
intelligence?.Dispose();
}
///
/// Tests that disposing the intelligence twice does not throw.
///
[Test]
public async ValueTask DisposeTwiceDoesNotThrowAsync()
{
// Arrange
var player = await this.CreateOfflinePlayerAsync().ConfigureAwait(false);
var intelligence = new OfflinePlayerMuHelper(player);
intelligence.Start();
// Act & Assert
intelligence.Dispose();
intelligence.Dispose();
}
private async ValueTask CreateOfflinePlayerAsync()
{
return await PlayerTestHelper.CreateOfflineLevelingPlayerAsync(this._gameContext).ConfigureAwait(false);
}
}