82 lines
1.7 KiB
C#
82 lines
1.7 KiB
C#
using MyBiz.Core;
|
|
|
|
namespace MyBiz.Tests;
|
|
|
|
public class BuildingTests
|
|
{
|
|
[Fact]
|
|
public void Building_CalculateEfficiency_FullWorkers_ShouldBeMax()
|
|
{
|
|
// Arrange
|
|
var config = new BuildingTypeConfig
|
|
{
|
|
Id = "factory",
|
|
BaseEfficiency = 100,
|
|
WorkerSlots = 10
|
|
};
|
|
|
|
var building = new Building
|
|
{
|
|
TypeConfig = config,
|
|
Workers = 10,
|
|
Level = 1
|
|
};
|
|
|
|
// Act
|
|
building.CalculateEfficiency();
|
|
|
|
// Assert
|
|
Assert.Equal(100, building.CurrentEfficiency);
|
|
}
|
|
|
|
[Fact]
|
|
public void Building_CalculateEfficiency_NoWorkers_ShouldBeZero()
|
|
{
|
|
// Arrange
|
|
var config = new BuildingTypeConfig
|
|
{
|
|
Id = "factory",
|
|
BaseEfficiency = 100,
|
|
WorkerSlots = 10
|
|
};
|
|
|
|
var building = new Building
|
|
{
|
|
TypeConfig = config,
|
|
Workers = 0,
|
|
Level = 1
|
|
};
|
|
|
|
// Act
|
|
building.CalculateEfficiency();
|
|
|
|
// Assert
|
|
Assert.Equal(0, building.CurrentEfficiency);
|
|
}
|
|
|
|
[Fact]
|
|
public void Building_LevelBonus_ShouldIncreaseEfficiency()
|
|
{
|
|
// Arrange
|
|
var config = new BuildingTypeConfig
|
|
{
|
|
Id = "factory",
|
|
BaseEfficiency = 100,
|
|
WorkerSlots = 10
|
|
};
|
|
|
|
var building = new Building
|
|
{
|
|
TypeConfig = config,
|
|
Workers = 10,
|
|
Level = 5
|
|
};
|
|
|
|
// Act
|
|
building.CalculateEfficiency();
|
|
|
|
// Assert
|
|
Assert.Equal(120, building.CurrentEfficiency); // 100 + (4 * 5)
|
|
}
|
|
}
|