public void Create_WithStochasticSoilProfiles_ReturnsStochasticSoilModelEntityWithPropertiesSet()
        {
            // Setup
            var stochasticSoilProfiles = new[]
            {
                new MacroStabilityInwardsStochasticSoilProfile(0.1, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()),
                new MacroStabilityInwardsStochasticSoilProfile(0.9, MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D())
            };
            MacroStabilityInwardsStochasticSoilModel stochasticSoilModel =
                MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("Model", stochasticSoilProfiles);

            var registry = new PersistenceRegistry();

            // Call
            StochasticSoilModelEntity entity = stochasticSoilModel.Create(registry, 0);

            // Assert
            Assert.IsNotNull(entity);
            CollectionAssert.IsEmpty(entity.PipingStochasticSoilProfileEntities);
            Assert.AreEqual(stochasticSoilProfiles.Length, entity.MacroStabilityInwardsStochasticSoilProfileEntities.Count);

            MacroStabilityInwardsStochasticSoilProfile       firstStochasticSoilProfile       = stochasticSoilProfiles[0];
            MacroStabilityInwardsStochasticSoilProfileEntity firstStochasticSoilProfileEntity = entity.MacroStabilityInwardsStochasticSoilProfileEntities.First();

            Assert.AreEqual(firstStochasticSoilProfile.Probability, firstStochasticSoilProfileEntity.Probability);
            Assert.IsNotNull(firstStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileOneDEntity);
            Assert.IsNull(firstStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileTwoDEntity);

            MacroStabilityInwardsStochasticSoilProfile       secondStochasticSoilProfile       = stochasticSoilProfiles[1];
            MacroStabilityInwardsStochasticSoilProfileEntity secondStochasticSoilProfileEntity = entity.MacroStabilityInwardsStochasticSoilProfileEntities.ElementAt(1);

            Assert.AreEqual(secondStochasticSoilProfile.Probability, secondStochasticSoilProfileEntity.Probability);
            Assert.IsNull(secondStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileOneDEntity);
            Assert.IsNotNull(secondStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a collection of <see cref="MacroStabilityInwardsStochasticSoilProfile"/>
 /// with all the supported <see cref="IMacroStabilityInwardsSoilProfile{T}"/>.
 /// </summary>
 /// <returns>A collection of <see cref="MacroStabilityInwardsStochasticSoilProfile"/>.</returns>
 private static List <MacroStabilityInwardsStochasticSoilProfile> CreateStochasticSoilProfiles()
 {
     return(new List <MacroStabilityInwardsStochasticSoilProfile>
     {
         new MacroStabilityInwardsStochasticSoilProfile(0.5, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()),
         new MacroStabilityInwardsStochasticSoilProfile(0.5, MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D())
     });
 }
Esempio n. 3
0
        public void ClearStochasticSoilProfileDependentData_WithoutFailureMechanism_ThrowsArgumentNullException()
        {
            // Call
            void Call() => MacroStabilityInwardsDataSynchronizationService.ClearStochasticSoilProfileDependentData(
                null, new MacroStabilityInwardsStochasticSoilProfile(0.5, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()));

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("failureMechanism", exception.ParamName);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a simple model with names for the model and profiles in the model set as specified.
        /// </summary>
        /// <param name="modelName">Name of the created model.</param>
        /// <param name="profileNames">List of names for the profiles to be added to the model.</param>
        /// <returns>A new <see cref="MacroStabilityInwardsStochasticSoilModel"/>.</returns>
        private static MacroStabilityInwardsStochasticSoilModel CreateSimpleModel(string modelName, params string[] profileNames)
        {
            var stochasticSoilProfiles = new List <MacroStabilityInwardsStochasticSoilProfile>();

            foreach (string profileName in profileNames)
            {
                MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(profileName);
                stochasticSoilProfiles.Add(new MacroStabilityInwardsStochasticSoilProfile(1.0 / profileNames.Length, soilProfile));
            }

            return(MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel(modelName, stochasticSoilProfiles));
        }
        public void UpdateSurfaceLinesWithImportedData_WithCalculationAssignedToRemovedLine_UpdatesCalculationAndDoesNotRemoveStochasticSoilInputs()
        {
            // Setup
            var soilModel = new MacroStabilityInwardsStochasticSoilModel("A", new[]
            {
                new Point2D(2, -1),
                new Point2D(2, 1)
            }, new[]
            {
                new MacroStabilityInwardsStochasticSoilProfile(0.2, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D())
            });

            MacroStabilityInwardsSurfaceLine surfaceLine = CreateValidSurfaceLineForCalculations();
            var calculation = new MacroStabilityInwardsCalculation
            {
                InputParameters =
                {
                    SurfaceLine           = surfaceLine,
                    StochasticSoilModel   = soilModel,
                    StochasticSoilProfile = soilModel.StochasticSoilProfiles.ElementAt(0)
                }
            };

            var failureMechanism = new MacroStabilityInwardsFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(calculation);
            failureMechanism.SurfaceLines.AddRange(new[]
            {
                surfaceLine
            }, "path");
            failureMechanism.StochasticSoilModels.AddRange(new[]
            {
                soilModel
            }, "path");

            var strategy = new MacroStabilityInwardsSurfaceLineUpdateDataStrategy(failureMechanism);

            // Call
            IEnumerable <IObservable> affectedObjects = strategy.UpdateSurfaceLinesWithImportedData(Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(),
                                                                                                    "path").ToArray();

            // Assert
            MacroStabilityInwardsInput calculationInput = calculation.InputParameters;

            CollectionAssert.AreEquivalent(new IObservable[]
            {
                failureMechanism.SurfaceLines,
                calculationInput
            }, affectedObjects);
            Assert.IsNull(calculationInput.SurfaceLine);
            Assert.AreSame(soilModel, calculationInput.StochasticSoilModel);
            Assert.AreSame(soilModel.StochasticSoilProfiles.ElementAt(0), calculationInput.StochasticSoilProfile);
        }
Esempio n. 6
0
        public void StochasticSoilProfile_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
        {
            // Setup
            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
            var newProfile = new MacroStabilityInwardsStochasticSoilProfile(0, soilProfile);
            var newValue   = new DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilProfile>(newProfile);

            var calculation = new MacroStabilityInwardsCalculationScenario();

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.StochasticSoilProfile = newValue, calculation);
        }
Esempio n. 7
0
        public void GivenInput_WhenStochasticSoilProfileSetAndSurfaceLineNull_ThenSoilProfileUnderSurfaceLineNull()
        {
            // Given
            var inputParameters = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties());

            // When
            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();

            inputParameters.StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0, soilProfile);

            // Then
            Assert.IsNull(inputParameters.SoilProfileUnderSurfaceLine);
        }
Esempio n. 8
0
        public void Create_StringPropertiesDoNotShareReference()
        {
            // Setup
            const string name = "some name";
            MacroStabilityInwardsSoilProfile1D soilProfile =
                MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(name);
            var registry = new PersistenceRegistry();

            // Call
            MacroStabilityInwardsSoilProfileOneDEntity entity = soilProfile.Create(registry);

            // Assert
            TestHelper.AssertAreEqualButNotSame(name, entity.Name);
        }
        public void EditValue_WithCurrentItemNotInAvailableItems_ReturnsOriginalValue()
        {
            // Setup
            var mockRepository    = new MockRepository();
            var provider          = mockRepository.DynamicMock <IServiceProvider>();
            var service           = mockRepository.DynamicMock <IWindowsFormsEditorService>();
            var context           = mockRepository.DynamicMock <ITypeDescriptorContext>();
            var assessmentSection = mockRepository.Stub <IAssessmentSection>();
            var handler           = mockRepository.Stub <IObservablePropertyChangeHandler>();

            var calculation      = new MacroStabilityInwardsCalculationScenario();
            var failureMechanism = new MacroStabilityInwardsFailureMechanism();

            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
            var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties())
            {
                StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(1.0, soilProfile)
            };
            var inputContext = new MacroStabilityInwardsInputContext(input,
                                                                     calculation,
                                                                     Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(),
                                                                     new[]
            {
                MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel()
            },
                                                                     failureMechanism,
                                                                     assessmentSection);

            var properties = new MacroStabilityInwardsInputContextProperties(inputContext,
                                                                             AssessmentSectionTestHelper.GetTestAssessmentLevel,
                                                                             handler);

            var editor      = new MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditor();
            var someValue   = new object();
            var propertyBag = new DynamicPropertyBag(properties);

            provider.Expect(p => p.GetService(null)).IgnoreArguments().Return(service);
            service.Expect(s => s.DropDownControl(null)).IgnoreArguments();
            context.Expect(c => c.Instance).Return(propertyBag);

            mockRepository.ReplayAll();

            // Call
            object result = editor.EditValue(context, provider, someValue);

            // Assert
            Assert.AreSame(someValue, result);

            mockRepository.VerifyAll();
        }
Esempio n. 10
0
        public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
        {
            // Setup
            MacroStabilityInwardsSoilProfile1D soilProfile =
                MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();

            // Call
            TestDelegate test = () => soilProfile.Create(null);

            // Assert
            string parameterName = Assert.Throws <ArgumentNullException>(test).ParamName;

            Assert.AreEqual("registry", parameterName);
        }
Esempio n. 11
0
        public void GivenCreatedEntity_WhenCreateCalledOnSameObject_ThenSameEntityReturned()
        {
            // Given
            MacroStabilityInwardsSoilProfile1D soilProfile =
                MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
            var registry = new PersistenceRegistry();

            MacroStabilityInwardsSoilProfileOneDEntity firstEntity = soilProfile.Create(registry);

            // When
            MacroStabilityInwardsSoilProfileOneDEntity secondEntity = soilProfile.Create(registry);

            // Then
            Assert.AreSame(firstEntity, secondEntity);
        }
        /// <summary>
        /// Creates an instance of <see cref="MacroStabilityInwardsStochasticSoilModel"/>.
        /// </summary>
        /// <param name="soilModelName">The name of the soil model.</param>
        /// <param name="geometry">The geometry of the soil model.</param>
        /// <returns>A valid configured <see cref="MacroStabilityInwardsStochasticSoilModel"/> with the
        /// specified <paramref name="soilModelName"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="soilModelName"/> or
        /// <paramref name="geometry"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <oaramref name="geometry"/> is
        /// <c>empty</c>.</exception>
        public static MacroStabilityInwardsStochasticSoilModel CreateValidStochasticSoilModel(string soilModelName,
                                                                                              IEnumerable <Point2D> geometry)
        {
            MacroStabilityInwardsSoilProfile1D soilProfileA =
                MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D("A");
            MacroStabilityInwardsSoilProfile1D soilProfileB =
                MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D("B");

            var model = new MacroStabilityInwardsStochasticSoilModel(soilModelName, geometry, new[]
            {
                new MacroStabilityInwardsStochasticSoilProfile(0.5, soilProfileA),
                new MacroStabilityInwardsStochasticSoilProfile(0.5, soilProfileB)
            });

            return(model);
        }
Esempio n. 13
0
        public void Create_DifferentStochasticSoilProfilesWithSameMacroStabilityInwardsSoilProfile1D_ReturnsEntityWithSameSoilProfileEntitySet()
        {
            // Setup
            var random = new Random(31);

            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
            var firstStochasticSoilProfile  = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
            var secondStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
            var registry = new PersistenceRegistry();

            MacroStabilityInwardsStochasticSoilProfileEntity firstEntity = firstStochasticSoilProfile.Create(registry, 0);

            // Call
            MacroStabilityInwardsStochasticSoilProfileEntity secondEntity = secondStochasticSoilProfile.Create(registry, 0);

            // Assert
            Assert.AreSame(firstEntity.MacroStabilityInwardsSoilProfileOneDEntity, secondEntity.MacroStabilityInwardsSoilProfileOneDEntity);
            Assert.IsNull(firstEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
            Assert.IsNull(secondEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
        }
Esempio n. 14
0
        public void Constructor_ValidStochasticSoilProfile_ExpectedValues()
        {
            // Setup
            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
            var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(1.0, soilProfile);

            // Call
            var properties = new MacroStabilityInwardsStochasticSoilProfileProperties(stochasticSoilProfile);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <MacroStabilityInwardsStochasticSoilProfile> >(properties);
            TestHelper.AssertTypeConverter <MacroStabilityInwardsStochasticSoilProfileProperties, ExpandableObjectConverter>();
            TestHelper.AssertTypeConverter <MacroStabilityInwardsStochasticSoilProfileProperties,
                                            ExpandableArrayConverter>(nameof(MacroStabilityInwardsStochasticSoilProfileProperties.Layers1D));
            TestHelper.AssertTypeConverter <MacroStabilityInwardsStochasticSoilProfileProperties,
                                            ExpandableArrayConverter>(nameof(MacroStabilityInwardsStochasticSoilProfileProperties.Layers2D));
            TestHelper.AssertTypeConverter <MacroStabilityInwardsStochasticSoilProfileProperties,
                                            ExpandableArrayConverter>(nameof(MacroStabilityInwardsStochasticSoilProfileProperties.PreconsolidationStresses));
            Assert.AreSame(stochasticSoilProfile, properties.Data);
        }
Esempio n. 15
0
        public void GivenInput_WhenSurfaceLineAndStochasticSoilProfileSet_ThenSoilProfileUnderSurfaceLineSet()
        {
            // Given
            var inputParameters = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties());

            // When
            var surfaceLine = new MacroStabilityInwardsSurfaceLine("test");

            surfaceLine.SetGeometry(new[]
            {
                new Point3D(0, 0, 0),
                new Point3D(1, 1, 1)
            });
            inputParameters.SurfaceLine = surfaceLine;
            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();

            inputParameters.StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0, soilProfile);

            // Then
            Assert.IsNotNull(inputParameters.SoilProfileUnderSurfaceLine);
        }
        public void SyncStochasticSoilProfileWithStochasticSoilModel_MultipleStochasticSoilProfilesInStochasticSoilModel_DoesNotSetStochasticSoilProfile()
        {
            // Setup
            MacroStabilityInwardsStochasticSoilModel soilModel =
                MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("A", new[]
            {
                new MacroStabilityInwardsStochasticSoilProfile(0.0, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()),
                new MacroStabilityInwardsStochasticSoilProfile(1.0, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D())
            });

            var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties())
            {
                StochasticSoilModel = soilModel
            };

            // Call
            MacroStabilityInwardsInputService.SyncStochasticSoilProfileWithStochasticSoilModel(input);

            // Assert
            Assert.IsNull(input.StochasticSoilProfile);
        }
Esempio n. 17
0
        public void Create_WithMacroStabilityInwardsSoilProfile1D_ReturnsStochasticSoilProfileEntityWithPropertiesSet()
        {
            // Setup
            var random = new Random(31);
            MacroStabilityInwardsSoilProfile1D soilProfile =
                MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(nameof(MacroStabilityInwardsSoilProfile1D));
            var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);

            int order = random.Next();

            var registry = new PersistenceRegistry();

            // Call
            MacroStabilityInwardsStochasticSoilProfileEntity entity = stochasticSoilProfile.Create(registry, order);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(stochasticSoilProfile.Probability, entity.Probability);
            Assert.AreEqual(soilProfile.Name, entity.MacroStabilityInwardsSoilProfileOneDEntity.Name);
            Assert.IsNull(entity.MacroStabilityInwardsSoilProfileTwoDEntity);
            Assert.AreEqual(order, entity.Order);
        }
Esempio n. 18
0
        public void Update_ModelsWithAddedProfilesWithSameNames_ThrowsInvalidOperationException()
        {
            // Setup
            const string profileName = "Name of Profile";

            MacroStabilityInwardsSoilProfile1D soilProfileOne =
                MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(profileName);
            var addedStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.2, soilProfileOne);
            MacroStabilityInwardsStochasticSoilModel otherModel = CreateValidModel(new[]
            {
                addedStochasticSoilProfile
            });

            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(profileName);
            var existingStochasticSoilProfileOne           = new MacroStabilityInwardsStochasticSoilProfile(0.2, soilProfile);
            var existingStochasticSoilProfileTwo           = new MacroStabilityInwardsStochasticSoilProfile(0.3, soilProfile);

            MacroStabilityInwardsStochasticSoilModel model = CreateValidModel(new[]
            {
                existingStochasticSoilProfileOne,
                existingStochasticSoilProfileTwo
            });

            // Call
            TestDelegate call = () => model.Update(otherModel);

            // Assert
            Assert.Throws <InvalidOperationException>(call);

            Assert.AreEqual(1, otherModel.StochasticSoilProfiles.Count());
            Assert.AreEqual(addedStochasticSoilProfile, otherModel.StochasticSoilProfiles.First());

            Assert.AreEqual(2, model.StochasticSoilProfiles.Count());
            CollectionAssert.AreEqual(new[]
            {
                existingStochasticSoilProfileOne,
                existingStochasticSoilProfileTwo
            }, model.StochasticSoilProfiles);
        }
        public void SyncStochasticSoilProfileWithStochasticSoilModel_SingleStochasticSoilProfileInStochasticSoilModel_SetsStochasticSoilProfile()
        {
            // Setup
            var soilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.3, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D());

            MacroStabilityInwardsStochasticSoilModel soilModel =
                MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("A",
                                                                                                   new[]
            {
                soilProfile
            });

            var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties())
            {
                StochasticSoilModel = soilModel
            };

            // Call
            MacroStabilityInwardsInputService.SyncStochasticSoilProfileWithStochasticSoilModel(input);

            // Assert
            Assert.AreEqual(soilProfile, input.StochasticSoilProfile);
        }
Esempio n. 20
0
        private static IEnumerable <IMacroStabilityInwardsSoilProfile <IMacroStabilityInwardsSoilLayer> > GetMacroStabilityInwardsSoilProfiles()
        {
            yield return(MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D());

            yield return(MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D());
        }
        public void Create_CalculationWithAlreadyRegisteredStochasticSoilProfile_ReturnsEntityWithStochasticSoilModelEntity()
        {
            // Setup
            var random = new Random(21);
            var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(),
                                                                                       MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D());
            var scenario = new MacroStabilityInwardsCalculationScenario
            {
                InputParameters =
                {
                    StochasticSoilProfile = stochasticSoilProfile
                }
            };

            var registry = new PersistenceRegistry();
            var stochasticSoilProfileEntity = new MacroStabilityInwardsStochasticSoilProfileEntity();

            registry.Register(stochasticSoilProfileEntity, stochasticSoilProfile);

            // Call
            MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);

            // Assert
            Assert.IsNotNull(entity);
            MacroStabilityInwardsStochasticSoilProfileEntity expectedStochasticSoilProfileEntity = registry.Get(stochasticSoilProfile);

            Assert.AreSame(expectedStochasticSoilProfileEntity, entity.MacroStabilityInwardsStochasticSoilProfileEntity);
        }
Esempio n. 22
0
 protected override MacroStabilityInwardsSoilProfile1D CreateDataModel()
 {
     return(MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D());
 }
        public void Read_EntityWithStochasticSoilModel_ReturnCalculationScenarioWithInputObjectWithStochasticSoilModelPropertiesSet()
        {
            // Setup
            var random = new Random(21);
            MacroStabilityInwardsStochasticSoilModel stochasticSoilModel =
                MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel();
            var stochasticSoilModelEntity = new StochasticSoilModelEntity();

            var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(),
                                                                                       MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D());
            var stochasticSoilProfileEntity = new MacroStabilityInwardsStochasticSoilProfileEntity
            {
                StochasticSoilModelEntity = stochasticSoilModelEntity
            };

            var collector = new ReadConversionCollector();

            collector.Read(stochasticSoilModelEntity, stochasticSoilModel);
            collector.Read(stochasticSoilProfileEntity, stochasticSoilProfile);

            MacroStabilityInwardsCalculationEntity entity = CreateValidCalculationEntity();

            entity.MacroStabilityInwardsStochasticSoilProfileEntity = stochasticSoilProfileEntity;

            // Call
            MacroStabilityInwardsCalculationScenario calculation = entity.Read(collector);

            // Assert
            MacroStabilityInwardsInput inputParameters = calculation.InputParameters;

            Assert.AreSame(stochasticSoilModel, inputParameters.StochasticSoilModel);
            Assert.AreSame(stochasticSoilProfile, inputParameters.StochasticSoilProfile);
        }
Esempio n. 24
0
 protected override MacroStabilityInwardsStochasticSoilProfile CreateDataModel()
 {
     return(new MacroStabilityInwardsStochasticSoilProfile(1, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()));
 }