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 Constructor_ValidParameters_ExpectedValues() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call var properties = new AssessmentSectionAssemblyGroupsProperties(assessmentSection); // Assert Assert.IsInstanceOf <AssessmentSectionAssemblyGroupsProperties>(properties); Assert.AreSame(assessmentSection, properties.Data); TestHelper.AssertTypeConverter <AssessmentSectionAssemblyGroupsProperties, ExpandableArrayConverter>( nameof(AssessmentSectionAssemblyGroupsProperties.AssessmentSectionAssemblyGroups)); }
public void GetAssessmentSectionAssemblyGroups_AssemblyThrowsException_SetsEmptyProperties() { // Setup using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; AssessmentSectionAssemblyGroupBoundariesCalculatorStub calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyGroupBoundariesCalculator; calculator.ThrowExceptionOnCalculate = true; // Call var properties = new AssessmentSectionAssemblyGroupsProperties(new AssessmentSection(AssessmentSectionComposition.Dike)); // Assert Assert.IsEmpty(properties.AssessmentSectionAssemblyGroups); } }
public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Call var properties = new AssessmentSectionAssemblyGroupsProperties(new AssessmentSection(AssessmentSectionComposition.Dike)); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(1, dynamicProperties.Count); const string generalCategoryName = "Algemeen"; PropertyDescriptor assessmentSectionAssemblyGroupsProperty = dynamicProperties[0]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(assessmentSectionAssemblyGroupsProperty, generalCategoryName, "Veiligheidscategorieën", "De veiligheidscategorieën voor het traject.", true); }