public void GetAssessmentSectionAssemblyGroups_AssemblySucceeds_CorrectlySetsProperties() { // Setup using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; AssessmentSectionAssemblyGroupBoundariesCalculatorStub calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyGroupBoundariesCalculator; // Call var properties = new AssessmentSectionAssemblyGroupsProperties(new AssessmentSection(AssessmentSectionComposition.Dike)); // Assert AssessmentSectionAssemblyGroupProperties[] assessmentSectionAssemblyGroups = properties.AssessmentSectionAssemblyGroups; IEnumerable <AssessmentSectionAssemblyGroupBoundaries> output = calculator.AssessmentSectionAssemblyGroupBoundariesOutput; Assert.AreEqual(output.Count(), assessmentSectionAssemblyGroups.Length); for (var i = 0; i < output.Count(); i++) { AssessmentSectionAssemblyGroupBoundaries assemblyGroup = output.ElementAt(i); AssessmentSectionAssemblyGroupProperties property = assessmentSectionAssemblyGroups[i]; Assert.AreEqual(assemblyGroup.AssessmentSectionAssemblyGroup, property.Group); Assert.AreEqual(assemblyGroup.UpperBoundary, property.UpperBoundary); Assert.AreEqual(assemblyGroup.LowerBoundary, property.LowerBoundary); } } }
public void ToString_Always_ReturnsAssemblyGroupDisplayName() { // Setup var random = new Random(39); var assemblyGroup = random.NextEnumValue <AssessmentSectionAssemblyGroup>(); var properties = new AssessmentSectionAssemblyGroupProperties(new AssessmentSectionAssemblyGroupBoundaries( random.NextDouble(), random.NextDouble(), assemblyGroup)); // Call var result = properties.ToString(); // Assert Assert.AreEqual(EnumDisplayNameHelper.GetDisplayName(assemblyGroup), result); }
public void Constructor_Always_PropertiesHaveExpectedAttributeValues() { // Setup var random = new Random(39); var assemblyGroup = new AssessmentSectionAssemblyGroupBoundaries(random.NextDouble(), random.NextDouble(), random.NextEnumValue <AssessmentSectionAssemblyGroup>()); // Call var properties = new AssessmentSectionAssemblyGroupProperties(assemblyGroup); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(3, dynamicProperties.Count); const string generalCategoryName = "Algemeen"; PropertyDescriptor nameProperty = dynamicProperties[0]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, generalCategoryName, "Naam", "Naam van de veiligheidscategorie.", true); PropertyDescriptor lowerBoundaryProperty = dynamicProperties[1]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lowerBoundaryProperty, generalCategoryName, "Ondergrens [1/jaar]", "Ondergrens van de veiligheidscategorie.", true); PropertyDescriptor upperBoundaryProperty = dynamicProperties[2]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(upperBoundaryProperty, generalCategoryName, "Bovengrens [1/jaar]", "Bovengrens van de veiligheidscategorie.", true); }
public void Constructor_ValidParameters_ExpectedValues() { // Setup var random = new Random(39); var assemblyGroup = new AssessmentSectionAssemblyGroupBoundaries(random.NextDouble(), random.NextDouble(), random.NextEnumValue <AssessmentSectionAssemblyGroup>()); // Call var properties = new AssessmentSectionAssemblyGroupProperties(assemblyGroup); // Assert Assert.IsInstanceOf <ObjectProperties <AssessmentSectionAssemblyGroupBoundaries> >(properties); Assert.AreSame(assemblyGroup, properties.Data); TestHelper.AssertTypeConverter <AssessmentSectionAssemblyGroupProperties, ExpandableObjectConverter>(); Assert.AreEqual(assemblyGroup.AssessmentSectionAssemblyGroup, properties.Group); Assert.AreEqual(assemblyGroup.LowerBoundary, properties.LowerBoundary); Assert.AreEqual(assemblyGroup.UpperBoundary, properties.UpperBoundary); }