03b425a12f
Remove the CFM=0→zero test (CFM no longer in the formula path). Update expected values to match the new nozzle-primary tables and corrected TierDefaults CFM/nozzle pairings. Add WetBlasting and RustAndScale substrate coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
129 lines
4.3 KiB
C#
129 lines
4.3 KiB
C#
using PowderCoating.Application.Services;
|
|
using PowderCoating.Core.Entities;
|
|
using PowderCoating.Core.Enums;
|
|
|
|
namespace PowderCoating.UnitTests;
|
|
|
|
public class ShopCapabilityCalculatorTests
|
|
{
|
|
[Fact]
|
|
public void GetBlastRateSqFtPerHour_WithOverride_ReturnsOverride()
|
|
{
|
|
var costs = new CompanyOperatingCosts
|
|
{
|
|
BlastRateSqFtPerHourOverride = 42.5m,
|
|
CompressorCfm = 150m,
|
|
BlastNozzleSize = 6,
|
|
BlastSetupType = BlastSetupType.PressurePot,
|
|
PrimaryBlastSubstrate = BlastSubstrateType.Paint
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(costs);
|
|
|
|
Assert.Equal(42.5m, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetBlastRateSqFtPerHour_PressurePot_Nozzle6_Paint()
|
|
{
|
|
// PressurePotRateByNozzle(6) = 245 * SubstrateMultiplier(Paint) 1.0 = 245
|
|
var costs = new CompanyOperatingCosts
|
|
{
|
|
CompressorCfm = 200m,
|
|
BlastNozzleSize = 6,
|
|
BlastSetupType = BlastSetupType.PressurePot,
|
|
PrimaryBlastSubstrate = BlastSubstrateType.Paint
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(costs);
|
|
|
|
Assert.Equal(245m, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetBlastRateSqFtPerHour_SiphonCabinet_Nozzle4_Mixed()
|
|
{
|
|
// SiphonCabinetRateByNozzle(4) = 125 * SubstrateMultiplier(Mixed) 0.9 = 112.5
|
|
var setup = new CompanyBlastSetup
|
|
{
|
|
Name = "Main Cabinet",
|
|
CompressorCfm = 42m,
|
|
BlastNozzleSize = 4,
|
|
SetupType = BlastSetupType.SiphonCabinet,
|
|
PrimarySubstrate = BlastSubstrateType.Mixed
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(setup);
|
|
|
|
Assert.Equal(112.5m, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetBlastRateSqFtPerHour_PressurePot_Nozzle4_RustAndScale()
|
|
{
|
|
// PressurePotRateByNozzle(4) = 115 * SubstrateMultiplier(RustAndScale) 0.7 = 80.5
|
|
var costs = new CompanyOperatingCosts
|
|
{
|
|
BlastNozzleSize = 4,
|
|
BlastSetupType = BlastSetupType.PressurePot,
|
|
PrimaryBlastSubstrate = BlastSubstrateType.RustAndScale
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(costs);
|
|
|
|
Assert.Equal(80.5m, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetBlastRateSqFtPerHour_WetBlasting_Is60PctOfPressurePot()
|
|
{
|
|
// WetBlasting = PressurePotRateByNozzle(5) * 0.6 * substrate(Paint 1.0) = 175 * 0.6 = 105
|
|
var costs = new CompanyOperatingCosts
|
|
{
|
|
BlastNozzleSize = 5,
|
|
BlastSetupType = BlastSetupType.WetBlasting,
|
|
PrimaryBlastSubstrate = BlastSubstrateType.Paint
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(costs);
|
|
|
|
Assert.Equal(105m, result);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(CoatingGunType.Corona, 40)]
|
|
[InlineData(CoatingGunType.Tribo, 35)]
|
|
[InlineData(CoatingGunType.Both, 40)]
|
|
public void GetCoatingRateSqFtPerHour_ReturnsExpectedDefaultByGunType(CoatingGunType gunType, decimal expected)
|
|
{
|
|
var costs = new CompanyOperatingCosts
|
|
{
|
|
CoatingGunType = gunType
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetCoatingRateSqFtPerHour(costs);
|
|
|
|
Assert.Equal(expected, result);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(ShopCapabilityTier.Garage, BlastSetupType.SiphonCabinet, 7, 3, BlastSubstrateType.Mixed)]
|
|
[InlineData(ShopCapabilityTier.Small, BlastSetupType.PressurePot, 49, 3, BlastSubstrateType.Mixed)]
|
|
[InlineData(ShopCapabilityTier.Medium, BlastSetupType.PressurePot, 90, 4, BlastSubstrateType.Mixed)]
|
|
[InlineData(ShopCapabilityTier.Large, BlastSetupType.PressurePot, 150, 5, BlastSubstrateType.Mixed)]
|
|
public void TierDefaults_ReturnExpectedPresetValues(
|
|
ShopCapabilityTier tier,
|
|
BlastSetupType expectedSetup,
|
|
decimal expectedCfm,
|
|
int expectedNozzle,
|
|
BlastSubstrateType expectedSubstrate)
|
|
{
|
|
var defaults = ShopCapabilityCalculator.TierDefaults(tier);
|
|
|
|
Assert.Equal(expectedSetup, defaults.SetupType);
|
|
Assert.Equal(expectedCfm, defaults.Cfm);
|
|
Assert.Equal(expectedNozzle, defaults.NozzleSize);
|
|
Assert.Equal(expectedSubstrate, defaults.Substrate);
|
|
}
|
|
}
|