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<ICompanyLogoService>() 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 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
using PowderCoating.Application.Interfaces;
|
||||||
using PowderCoating.Core.Entities;
|
using PowderCoating.Core.Entities;
|
||||||
using PowderCoating.Core.Enums;
|
using PowderCoating.Core.Enums;
|
||||||
using PowderCoating.Infrastructure.Data;
|
using PowderCoating.Infrastructure.Data;
|
||||||
@@ -290,7 +291,8 @@ public class DepositsControllerTests
|
|||||||
var controller = new DepositsController(
|
var controller = new DepositsController(
|
||||||
uow,
|
uow,
|
||||||
userManager.Object,
|
userManager.Object,
|
||||||
Mock.Of<ILogger<DepositsController>>());
|
Mock.Of<ILogger<DepositsController>>(),
|
||||||
|
Mock.Of<ICompanyLogoService>());
|
||||||
|
|
||||||
controller.ControllerContext = new ControllerContext
|
controller.ControllerContext = new ControllerContext
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -253,7 +253,8 @@ public class GiftCertificatesControllerTests
|
|||||||
Mock.Of<IMapper>(),
|
Mock.Of<IMapper>(),
|
||||||
Mock.Of<ILogger<GiftCertificatesController>>(),
|
Mock.Of<ILogger<GiftCertificatesController>>(),
|
||||||
userManager.Object,
|
userManager.Object,
|
||||||
Mock.Of<IPdfService>());
|
Mock.Of<IPdfService>(),
|
||||||
|
Mock.Of<ICompanyLogoService>());
|
||||||
|
|
||||||
controller.ControllerContext = new ControllerContext { HttpContext = httpContext };
|
controller.ControllerContext = new ControllerContext { HttpContext = httpContext };
|
||||||
controller.TempData = new TempDataDictionary(httpContext, Mock.Of<ITempDataProvider>());
|
controller.TempData = new TempDataDictionary(httpContext, Mock.Of<ITempDataProvider>());
|
||||||
|
|||||||
@@ -417,7 +417,8 @@ public class PricingCalculationServiceTests
|
|||||||
IsAiItem = true,
|
IsAiItem = true,
|
||||||
ManualUnitPrice = 200m,
|
ManualUnitPrice = 200m,
|
||||||
Quantity = 1m,
|
Quantity = 1m,
|
||||||
SurfaceAreaSqFt = 50m
|
SurfaceAreaSqFt = 50m,
|
||||||
|
Coats = new List<CreateQuoteItemCoatDto> { new() { CoatName = "Base Coat", Sequence = 1 } }
|
||||||
},
|
},
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
@@ -425,7 +426,8 @@ public class PricingCalculationServiceTests
|
|||||||
IsLaborItem = true,
|
IsLaborItem = true,
|
||||||
Quantity = 1m,
|
Quantity = 1m,
|
||||||
SurfaceAreaSqFt = 50m,
|
SurfaceAreaSqFt = 50m,
|
||||||
EstimatedMinutes = 60
|
EstimatedMinutes = 60,
|
||||||
|
Coats = new List<CreateQuoteItemCoatDto> { new() { CoatName = "Base Coat", Sequence = 1 } }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -470,14 +472,16 @@ public class PricingCalculationServiceTests
|
|||||||
Description = "AI item",
|
Description = "AI item",
|
||||||
IsAiItem = true,
|
IsAiItem = true,
|
||||||
ManualUnitPrice = 100m,
|
ManualUnitPrice = 100m,
|
||||||
Quantity = 1m
|
Quantity = 1m,
|
||||||
|
Coats = new List<CreateQuoteItemCoatDto> { new() { CoatName = "Base Coat", Sequence = 1 } }
|
||||||
},
|
},
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Description = "Shelf item",
|
Description = "Shelf item",
|
||||||
IsSalesItem = true,
|
IsSalesItem = true,
|
||||||
ManualUnitPrice = 40m,
|
ManualUnitPrice = 40m,
|
||||||
Quantity = 1m
|
Quantity = 1m,
|
||||||
|
Coats = new List<CreateQuoteItemCoatDto> { new() { CoatName = "Base Coat", Sequence = 1 } }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user