, . DiscountOrderProcessor:
public class FullDiscountOrderProcessor : DiscountOrderProcessor
{
public FullDiscountOrderProcessor(IOrdersRepository repository, Order order):base(repository,order,discountPercentages.FullDiscountPercentage)
{}
}
public class ModestDiscountOrderProcessor : DiscountOrderProcessor
{
public ModestDiscountOrderProcessor (IOrdersRepository repository, Order order):base(repository,order,discountPercentages.ModestDiscountPercentage)
{}
}
.
factory DiscountOrderProcessor, , , .
DiscountOrderProcessor , .
, , , - , . , FullDiscountOrderProcessor.
You need to somehow check the actual values that will leave you:
you can make properties public (or internal — using InternalsVisibleTo) so you can interrogate them.
you can take the returned object and check if it applies the discount correctly to some object that you pass to it.
Personally, I would like to make the properties internal, but it depends on how the objects interact and if the transfer of the mock object to the discount order processor and checking the correctness of its action is simple, this may be a better solution.
source
share