From 71caa934616568e81bfa6bba3f3e1915da6658f5 Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Wed, 6 May 2026 13:38:18 -0400 Subject: [PATCH] Fix unit test build failures after logo service and pricing changes DepositsController and GiftCertificatesController gained a required ICompanyLogoService constructor parameter in the PDF logo fix; their test factories were not updated and failed to compile on Jenkins. Added Mock.Of() to both factory methods and the missing using directive to DepositsControllerTests. PricingCalculationService now only charges oven cost for items that have explicit coating layers (Coats collection non-empty), because sandblast/prep-only and labor items do not go in the oven. Two tests that tested the old "all items count toward oven fraction" logic were updated to include a single coat entry on each item, which restores the expected oven fraction math without changing the tested behaviour. Co-Authored-By: Claude Sonnet 4.6 --- .../DepositsControllerTests.cs | 4 +++- .../GiftCertificatesControllerTests.cs | 3 ++- .../PricingCalculationServiceTests.cs | 12 ++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/PowderCoating.UnitTests/DepositsControllerTests.cs b/tests/PowderCoating.UnitTests/DepositsControllerTests.cs index a2931bd..64b08b0 100644 --- a/tests/PowderCoating.UnitTests/DepositsControllerTests.cs +++ b/tests/PowderCoating.UnitTests/DepositsControllerTests.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Moq; +using PowderCoating.Application.Interfaces; using PowderCoating.Core.Entities; using PowderCoating.Core.Enums; using PowderCoating.Infrastructure.Data; @@ -290,7 +291,8 @@ public class DepositsControllerTests var controller = new DepositsController( uow, userManager.Object, - Mock.Of>()); + Mock.Of>(), + Mock.Of()); controller.ControllerContext = new ControllerContext { diff --git a/tests/PowderCoating.UnitTests/GiftCertificatesControllerTests.cs b/tests/PowderCoating.UnitTests/GiftCertificatesControllerTests.cs index 8b05d6f..d6f5ed2 100644 --- a/tests/PowderCoating.UnitTests/GiftCertificatesControllerTests.cs +++ b/tests/PowderCoating.UnitTests/GiftCertificatesControllerTests.cs @@ -253,7 +253,8 @@ public class GiftCertificatesControllerTests Mock.Of(), Mock.Of>(), userManager.Object, - Mock.Of()); + Mock.Of(), + Mock.Of()); controller.ControllerContext = new ControllerContext { HttpContext = httpContext }; controller.TempData = new TempDataDictionary(httpContext, Mock.Of()); diff --git a/tests/PowderCoating.UnitTests/PricingCalculationServiceTests.cs b/tests/PowderCoating.UnitTests/PricingCalculationServiceTests.cs index 55a1cec..86fcea1 100644 --- a/tests/PowderCoating.UnitTests/PricingCalculationServiceTests.cs +++ b/tests/PowderCoating.UnitTests/PricingCalculationServiceTests.cs @@ -417,7 +417,8 @@ public class PricingCalculationServiceTests IsAiItem = true, ManualUnitPrice = 200m, Quantity = 1m, - SurfaceAreaSqFt = 50m + SurfaceAreaSqFt = 50m, + Coats = new List { new() { CoatName = "Base Coat", Sequence = 1 } } }, new() { @@ -425,7 +426,8 @@ public class PricingCalculationServiceTests IsLaborItem = true, Quantity = 1m, SurfaceAreaSqFt = 50m, - EstimatedMinutes = 60 + EstimatedMinutes = 60, + Coats = new List { new() { CoatName = "Base Coat", Sequence = 1 } } } }; @@ -470,14 +472,16 @@ public class PricingCalculationServiceTests Description = "AI item", IsAiItem = true, ManualUnitPrice = 100m, - Quantity = 1m + Quantity = 1m, + Coats = new List { new() { CoatName = "Base Coat", Sequence = 1 } } }, new() { Description = "Shelf item", IsSalesItem = true, ManualUnitPrice = 40m, - Quantity = 1m + Quantity = 1m, + Coats = new List { new() { CoatName = "Base Coat", Sequence = 1 } } } };