public void Constructor_ExpectedValues() { // Setup var mockRepository = new MockRepository(); var handler = mockRepository.Stub <IObservablePropertyChangeHandler>(); var assessmentSection = mockRepository.Stub <IAssessmentSection>(); mockRepository.ReplayAll(); var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); var context = new GrassCoverErosionOutwardsWaveConditionsInputContext( calculation.InputParameters, calculation, assessmentSection, Enumerable.Empty <ForeshoreProfile>()); // Call var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties( context, AssessmentSectionTestHelper.GetTestAssessmentLevel, handler); // Assert Assert.IsInstanceOf <WaveConditionsInputContextProperties < GrassCoverErosionOutwardsWaveConditionsInputContext, GrassCoverErosionOutwardsWaveConditionsInput, GrassCoverErosionOutwardsWaveConditionsCalculationType> >(properties); Assert.AreSame(context, properties.Data); Assert.AreEqual(calculation.InputParameters.CalculationType, properties.RevetmentType); mockRepository.VerifyAll(); }
public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); var handler = mocks.Stub <IObservablePropertyChangeHandler>(); mocks.ReplayAll(); var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); var context = new GrassCoverErosionOutwardsWaveConditionsInputContext( calculation.InputParameters, calculation, assessmentSection, Enumerable.Empty <ForeshoreProfile>()); // Call var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties( context, AssessmentSectionTestHelper.GetTestAssessmentLevel, handler); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(16, dynamicProperties.Count); PropertyDescriptor revetmentTypeProperty = dynamicProperties[10]; Assert.IsInstanceOf <EnumTypeConverter>(revetmentTypeProperty.Converter); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(revetmentTypeProperty, "Modelinstellingen", "Type bekleding", "Het type van de bekleding waarvoor berekend wordt."); mocks.VerifyAll(); }
public void RevetmentType_SetNewValue_InputChangedAndObservablesNotified() { // Setup var random = new Random(21); var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); var observable = mocks.StrictMock <IObservable>(); observable.Expect(o => o.NotifyObservers()); mocks.ReplayAll(); var customHandler = new SetPropertyValueAfterConfirmationParameterTester(new[] { observable }); var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); var context = new GrassCoverErosionOutwardsWaveConditionsInputContext( calculation.InputParameters, calculation, assessmentSection, Enumerable.Empty <ForeshoreProfile>()); var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties( context, AssessmentSectionTestHelper.GetTestAssessmentLevel, customHandler); // Call properties.RevetmentType = random.NextEnumValue <GrassCoverErosionOutwardsWaveConditionsCalculationType>(); // Assert Assert.IsTrue(customHandler.Called); mocks.VerifyAll(); }