public void Setup() { Config = Substitute.For <IConfigService>(); GrossPayValidator = Substitute.For <IGrossPayValidator>(); GoodCalculator = Substitute.For <IGoodCalculator>(); Config.GetTaxBands().Returns(GetTestTaxBands()); Config.GetNatInsuranceBands().Returns(GetTestNIBands()); GrossPayValidator.IsValid(GetValidInput().GrossPayInput).Returns(GetValidGrossPayResponse()); GrossPayValidator.IsValid(GetInvalidInput().GrossPayInput).Returns(GetInvalidGrossPayResponse()); GoodCalculator.Calculate(Arg.Any <double>(), Arg.Any <List <TaxBand> >(), Arg.Any <List <TaxBand> >()); Controller = new HomeController(Config, GrossPayValidator, GoodCalculator); }
public HomeController(IConfigService config, IGrossPayValidator grossPayValidator, IGoodCalculator goodCalculator) { _config = config; _grossPayValidator = grossPayValidator; _goodCalculator = goodCalculator; }
public TaxCalculator(IConfigService config, IGrossPayValidator grossPayValidator, IGoodCalculator goodCalculator) { _config = config; _grossPayValidator = grossPayValidator; _goodCalculator = goodCalculator; }