public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup var items = new[] { new TestWaveConditionsOutput() }; var waveImpactAsphaltCoverWaveConditionsOutput = new WaveImpactAsphaltCoverWaveConditionsOutput(items); // Call var properties = new WaveImpactAsphaltCoverWaveConditionsOutputProperties { Data = waveImpactAsphaltCoverWaveConditionsOutput }; // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(1, dynamicProperties.Count); PropertyDescriptor itemsProperty = dynamicProperties[0]; Assert.IsNotNull(itemsProperty); Assert.IsTrue(itemsProperty.IsReadOnly); Assert.IsInstanceOf <ExpandableArrayConverter>(itemsProperty.Converter); Assert.AreEqual("Resultaat", itemsProperty.Category); Assert.AreEqual("Hydraulische belastingen voor asfalt", itemsProperty.DisplayName); Assert.AreEqual("Berekende hydraulische belastingen voor asfalt.", itemsProperty.Description); }
public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup var mocks = new MockRepository(); using (var treeViewControl = new TreeViewControl()) { var output = new WaveImpactAsphaltCoverWaveConditionsOutput(Enumerable.Empty <WaveConditionsOutput>()); var menuBuilder = mocks.StrictMock <IContextMenuBuilder>(); using (mocks.Ordered()) { menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); } var gui = mocks.Stub <IGui>(); gui.Stub(cmp => cmp.Get(output, treeViewControl)).Return(menuBuilder); mocks.ReplayAll(); using (var plugin = new WaveImpactAsphaltCoverPlugin()) { TreeNodeInfo info = GetInfo(plugin); plugin.Gui = gui; // Call info.ContextMenuStrip(output, null, treeViewControl); } } // Assert mocks.VerifyAll(); }
public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup WaveImpactAsphaltCoverWaveConditionsOutput original = WaveImpactAsphaltCoverTestDataGenerator.GetRandomWaveImpactAsphaltCoverWaveConditionsOutput(); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, WaveImpactAsphaltCoverCloneAssert.AreClones); }
public void Image_Always_ReturnOutputIcon() { // Setup var output = new WaveImpactAsphaltCoverWaveConditionsOutput(Enumerable.Empty <WaveConditionsOutput>()); using (var plugin = new WaveImpactAsphaltCoverPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Image icon = info.Image(output); // Assert TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GeneralOutputIcon, icon); } }
public void Text_Always_ReturnName() { // Setup var output = new WaveImpactAsphaltCoverWaveConditionsOutput(Enumerable.Empty <WaveConditionsOutput>()); using (var plugin = new WaveImpactAsphaltCoverPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call string nodeText = info.Text(output); // Assert Assert.AreEqual("Resultaat", nodeText); } }
public void Constructor_ExpectedValues() { // Setup var outputItems = new[] { new TestWaveConditionsOutput() }; // Call var output = new WaveImpactAsphaltCoverWaveConditionsOutput(outputItems); // Assert Assert.IsInstanceOf <CloneableObservable>(output); Assert.IsInstanceOf <ICalculationOutput>(output); Assert.AreSame(outputItems, output.Items); }
public void IsEnabled_CalculationInSubFolder_ReturnExpectedEnabledState(bool hasOutput) { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); var calculationGroup = new CalculationGroup(); WaveImpactAsphaltCoverWaveConditionsOutput waveImpactAsphaltCoverWaveConditionsOutput = null; if (hasOutput) { var output = new[] { new TestWaveConditionsOutput() }; waveImpactAsphaltCoverWaveConditionsOutput = new WaveImpactAsphaltCoverWaveConditionsOutput(output); } calculationGroup.Children.Add( new CalculationGroup { Children = { new WaveImpactAsphaltCoverWaveConditionsCalculation { Output = waveImpactAsphaltCoverWaveConditionsOutput } } }); var context = new WaveImpactAsphaltCoverCalculationGroupContext(calculationGroup, null, failureMechanism, assessmentSection); // Call bool isEnabled = info.IsEnabled(context); // Assert Assert.AreEqual(hasOutput, isEnabled); }
public void Data_WithCalculationOutput_ReturnsExpectedValues() { // Setup var items = new[] { new TestWaveConditionsOutput() }; var waveImpactAsphaltCoverWaveConditionsOutput = new WaveImpactAsphaltCoverWaveConditionsOutput(items); // Call var properties = new WaveImpactAsphaltCoverWaveConditionsOutputProperties { Data = waveImpactAsphaltCoverWaveConditionsOutput }; // Assert CollectionAssert.AllItemsAreInstancesOfType(properties.Items, typeof(WaveConditionsOutputProperties)); Assert.AreEqual(items.Length, properties.Items.Length); WaveConditionsOutput expectedOutputProperty = items[0]; WaveConditionsOutputProperties firstOutputProperties = properties.Items[0]; Assert.AreEqual(expectedOutputProperty.WaterLevel, firstOutputProperties.WaterLevel); Assert.AreEqual(expectedOutputProperty.WaveHeight, firstOutputProperties.WaveHeight); Assert.AreEqual(expectedOutputProperty.WavePeakPeriod, firstOutputProperties.WavePeakPeriod); Assert.AreEqual(expectedOutputProperty.WaveAngle, firstOutputProperties.WaveAngle); Assert.AreEqual(expectedOutputProperty.WaveDirection, firstOutputProperties.WaveDirection); Assert.AreEqual(expectedOutputProperty.TargetProbability, firstOutputProperties.TargetProbability); Assert.AreEqual(expectedOutputProperty.TargetReliability, firstOutputProperties.TargetReliability, firstOutputProperties.TargetReliability.GetAccuracy()); Assert.AreEqual(expectedOutputProperty.TargetProbability, firstOutputProperties.TargetProbability); Assert.AreEqual(expectedOutputProperty.TargetReliability, firstOutputProperties.TargetReliability, firstOutputProperties.TargetReliability.GetAccuracy()); string convergenceValue = EnumDisplayNameHelper.GetDisplayName(expectedOutputProperty.CalculationConvergence); Assert.AreEqual(convergenceValue, firstOutputProperties.Convergence); }
/// <summary> /// Method that asserts whether <paramref name="original"/> and <paramref name="clone"/> /// are clones. /// </summary> /// <param name="original">The original object.</param> /// <param name="clone">The cloned object.</param> /// <exception cref="AssertionException">Thrown when <paramref name="original"/> and /// <paramref name="clone"/> are not clones.</exception> public static void AreClones(WaveImpactAsphaltCoverWaveConditionsOutput original, WaveImpactAsphaltCoverWaveConditionsOutput clone) { CoreCloneAssert.AreEnumerationClones(original.Items, clone.Items, WaveConditionsCloneAssert.AreClones); }