public void Arrange() { _configurationProvider = new Mock <ICalculatorSettings>(); _configurationProvider.Setup(x => x.LevyPercentage).Returns(0.005m); _configurationProvider.Setup(x => x.LevyAllowance).Returns(15000); _configurationProvider.Setup(x => x.LevyTopupPercentage).Returns(1.1m); _forecastCalculator = new ForecastCalculator(null, _configurationProvider.Object); }
public void Arrange() { //Arrange _myStandards = new List <CohortModel>(); for (var i = 0; i < StandardQty.Length - 1; i++) { _myStandards.Add(new CohortModel { Code = StandardCode[i], Qty = StandardQty[i], StartDate = StandardStartDate[i] }); } _myMultipleStandards = new List <CohortModel>(); for (var i = 0; i < StandardQty.Length; i++) { _myMultipleStandards.Add(new CohortModel { Code = StandardCode[i], Qty = StandardQty[i], StartDate = StandardStartDate[i] }); } _standardsRepository = new Mock <IApprenticeshipRepository>(); _standardsRepository.Setup(r => r.GetByCodeAsync("1")).Returns(Task.FromResult(new Apprenticeship { Price = 6000, Duration = 12 })); _standardsRepository.Setup(r => r.GetByCodeAsync("2")).Returns(Task.FromResult(new Apprenticeship { Price = 1400, Duration = 12 })); _configurationProvider = new Mock <ICalculatorSettings>(); _configurationProvider.Setup(cp => cp.LevyPercentage).Returns(0.005m); _configurationProvider.Setup(cp => cp.LevyAllowance).Returns(15000); _configurationProvider.Setup(cp => cp.LevyTopupPercentage).Returns(1.1m); _configurationProvider.Setup(cp => cp.CopaymentPercentage).Returns(0.1m); _configurationProvider.Setup(cp => cp.FinalTrainingPaymentPercentage).Returns(0m); _configurationProvider.Setup(cp => cp.SunsettingPeriod).Returns(18); _calculator = new ForecastCalculator(_standardsRepository.Object, _configurationProvider.Object); }
public void ArePlanetsAndSunAligned() { var star = new Planet(0, 0); var planets = new List <Planet> { new Planet(90, 500), new Planet(90, 2000), new Planet(90, 1000) }; var system = new StarSystem(star, planets); system.TranslateStep(); var calculator = new ForecastCalculator(system); bool result = calculator.ArePlanetsAndSunAligned(); Assert.IsTrue(result); }
public void TriangleHasMaxPerimeterTest() { var star = new Planet(0, 0); var planets = new List <Planet> { new Planet(90, 500), new Planet(225, 1000), new Planet(315, 1500) }; var system = new StarSystem(star, planets); system.TranslateStep(); var calculator = new ForecastCalculator(system); bool result = calculator.HasTriangleMaxPerimeter(); Assert.IsTrue(result); }
public void StarNotContainedInTriangleNegativeOrientationTest() { var star = new Planet(0, 0); var planets = new List <Planet> { new Planet(180, 500), new Planet(135, 1000), new Planet(225, 1500) }; var system = new StarSystem(star, planets); system.TranslateStep(); var calculator = new ForecastCalculator(system); bool result = calculator.IsStarContainedInPlanetsTriangle(); Assert.IsFalse(result); }
public void TriangleDoesNotHaveMaxPerimeterTest() { var star = new Planet(0, 0); // a "not-so-perfect" case var planets = new List <Planet> { new Planet(0, 500), new Planet(90, 1000), new Planet(225, 1500) }; var system = new StarSystem(star, planets); system.TranslateStep(); var calculator = new ForecastCalculator(system); bool result = calculator.HasTriangleMaxPerimeter(); Assert.IsFalse(result); }
public void ArePlanetsAlignedButNotWithSunTest() { var star = new Planet(0, 0); var planets = new List <Planet> { new Planet(-1, 500), new Planet(35, 1500), new Planet(27, 1000) }; var system = new StarSystem(star, planets); system.TranslateStep(); var calculator = new ForecastCalculator(system); bool result = calculator.ArePlanetsAligned(); Assert.IsTrue(result); result = calculator.ArePlanetsAndSunAligned(); Assert.IsFalse(result); }