dbe4170986
116 tests passing: JobPhotoService, MeasurementConversionService, PlatformSettingsService, QuoteApprovalController, QuotePhotoService, ShopCapabilityCalculator, StorageMigrationService, TenantContext, UsageQuotaController — plus expanded PricingCalculation, Registration, and Subscription tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
108 lines
3.4 KiB
C#
108 lines
3.4 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_WithNoCompressorCfm_ReturnsZero()
|
|
{
|
|
var costs = new CompanyOperatingCosts
|
|
{
|
|
CompressorCfm = 0m
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(costs);
|
|
|
|
Assert.Equal(0m, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetBlastRateSqFtPerHour_DerivesRateFromEquipmentInputs()
|
|
{
|
|
var costs = new CompanyOperatingCosts
|
|
{
|
|
CompressorCfm = 150m,
|
|
BlastNozzleSize = 6,
|
|
BlastSetupType = BlastSetupType.PressurePot,
|
|
PrimaryBlastSubstrate = BlastSubstrateType.Paint
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(costs);
|
|
|
|
Assert.Equal(58.5m, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetBlastRateSqFtPerHour_ForNamedSetup_UsesSetupOverload()
|
|
{
|
|
var setup = new CompanyBlastSetup
|
|
{
|
|
Name = "Main Cabinet",
|
|
CompressorCfm = 7m,
|
|
BlastNozzleSize = 4,
|
|
SetupType = BlastSetupType.SiphonCabinet,
|
|
PrimarySubstrate = BlastSubstrateType.Mixed
|
|
};
|
|
|
|
var result = ShopCapabilityCalculator.GetBlastRateSqFtPerHour(setup);
|
|
|
|
Assert.Equal(1.7m, 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, 4, BlastSubstrateType.Mixed)]
|
|
[InlineData(ShopCapabilityTier.Small, BlastSetupType.PressurePot, 40, 5, BlastSubstrateType.Mixed)]
|
|
[InlineData(ShopCapabilityTier.Medium, BlastSetupType.PressurePot, 80, 5, BlastSubstrateType.Mixed)]
|
|
[InlineData(ShopCapabilityTier.Large, BlastSetupType.PressurePot, 150, 6, 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);
|
|
}
|
|
}
|