//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Tests.Offline;
using NUnit.Framework;
using MUnique.OpenMU.GameLogic;
using MUnique.OpenMU.GameLogic.MuHelper;
using MUnique.OpenMU.GameLogic.Offline;
using MUnique.OpenMU.GameServer.RemoteView.MuHelper;
///
/// Tests for .
///
[TestFixture]
public class BuffHandlerTests
{
private IGameContext _gameContext = null!;
///
/// Sets up a fresh game context before each test.
///
[SetUp]
public void SetUp()
{
this._gameContext = GameContextTestHelper.CreateGameContext();
}
///
/// Tests that returns true immediately
/// when no buff skills are configured.
///
[Test]
public async ValueTask ReturnsTrueWhenNoBuffsConfiguredAsync()
{
// Arrange
var player = await this.CreateOfflinePlayerAsync().ConfigureAwait(false);
var config = new MuHelperSettings
{
BuffSkill0Id = 0,
BuffSkill1Id = 0,
BuffSkill2Id = 0,
};
var handler = new BuffHandler(player, config);
// Act
var result = await handler.PerformBuffsAsync().ConfigureAwait(false);
// Assert
Assert.That(result, Is.True);
}
///
/// Tests that returns true when config is null.
///
[Test]
public async ValueTask ReturnsTrueWhenConfigNullAsync()
{
// Arrange
var player = await this.CreateOfflinePlayerAsync().ConfigureAwait(false);
var handler = new BuffHandler(player, null);
// Act
var result = await handler.PerformBuffsAsync().ConfigureAwait(false);
// Assert
Assert.That(result, Is.True);
}
private async ValueTask CreateOfflinePlayerAsync()
{
return await PlayerTestHelper.CreateOfflineLevelingPlayerAsync(this._gameContext).ConfigureAwait(false);
}
}