public void Calculate_CancelCalculationWithValidInput_CancelsCalculator() { // Setup var calculator = new TestWaveHeightCalculator(); var mockRepository = new MockRepository(); var calculatorFactory = mockRepository.StrictMock <IHydraRingCalculatorFactory>(); calculatorFactory.Expect(cf => cf.CreateWaveHeightCalculator(null)) .IgnoreArguments() .Return(calculator); var calculationMessageProvider = mockRepository.Stub <ICalculationMessageProvider>(); mockRepository.ReplayAll(); var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { var service = new WaveHeightCalculationService(); calculator.CalculationFinishedHandler += (s, e) => service.Cancel(); // Call service.Calculate(hydraulicBoundaryLocationCalculation, CreateCalculationSettings(), 1.0 / 30, calculationMessageProvider); // Assert Assert.IsTrue(calculator.IsCanceled); } mockRepository.VerifyAll(); }
public void Constructor_ExpectedValues() { // Call var calculationService = new WaveHeightCalculationService(); // Assert Assert.IsInstanceOf <TargetProbabilityCalculationService>(calculationService); }