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);
        }
예제 #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())
     });
 }
예제 #3
0
        public void Create_DifferentStochasticSoilProfilesWithSameMacroStabilityInwardsSoilProfile2D_ReturnsEntityWithSameSoilProfileEntitySet()
        {
            // Setup
            var random = new Random(31);

            MacroStabilityInwardsSoilProfile2D soilProfile = MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D();
            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.IsNull(firstEntity.MacroStabilityInwardsSoilProfileOneDEntity);
            Assert.IsNull(secondEntity.MacroStabilityInwardsSoilProfileOneDEntity);
            Assert.AreSame(firstEntity.MacroStabilityInwardsSoilProfileTwoDEntity, secondEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
        }
예제 #4
0
        public void Create_WithMacroStabilityInwardsSoilProfile2D_ReturnsStochasticSoilProfileEntityWithPropertiesSet()
        {
            // Setup
            var random = new Random(31);
            MacroStabilityInwardsSoilProfile2D soilProfile =
                MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D();
            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.IsNull(entity.MacroStabilityInwardsSoilProfileOneDEntity);
            Assert.AreEqual(soilProfile.Name, entity.MacroStabilityInwardsSoilProfileTwoDEntity.Name);
            Assert.AreEqual(order, entity.Order);
        }
예제 #5
0
        private static IEnumerable <IMacroStabilityInwardsSoilProfile <IMacroStabilityInwardsSoilLayer> > GetMacroStabilityInwardsSoilProfiles()
        {
            yield return(MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D());

            yield return(MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D());
        }