Пример #1
0
        public void Transform_SoilProfile2DWithLayerFilledWithOtherLayer_ReturnsProfileWithBottomAndLayers()
        {
            // Setup
            const string     profileName         = "SomeProfile";
            const long       pipingSoilProfileId = 1234L;
            List <Segment2D> loopHole            = Segment2DLoopCollectionHelper.CreateFromString(
                string.Join(Environment.NewLine,
                            "5",
                            ".....",
                            ".4.1.",
                            ".3.2.",
                            ".....",
                            "....."));

            SoilLayer2D soilLayer2D = SoilLayer2DTestFactory.CreateSoilLayer2D(
                new[]
            {
                loopHole
            },
                Segment2DLoopCollectionHelper.CreateFromString(
                    string.Join(Environment.NewLine,
                                "5",
                                "2...3",
                                ".....",
                                ".....",
                                ".....",
                                "1...4")));

            var profile = new SoilProfile2D(pipingSoilProfileId, profileName,
                                            new List <SoilLayer2D>
            {
                soilLayer2D,
                SoilLayer2DTestFactory.CreateSoilLayer2D(
                    new List <Segment2D[]>(),
                    loopHole)
            }, Enumerable.Empty <PreconsolidationStress>())
            {
                IntersectionX = 2.0
            };

            // Call
            PipingSoilProfile transformed = PipingSoilProfileTransformer.Transform(profile);

            // Assert
            Assert.AreEqual(profileName, transformed.Name);
            Assert.AreEqual(SoilProfileType.SoilProfile2D, transformed.SoilProfileSourceType);
            Assert.AreEqual(4, transformed.Layers.Count());
            CollectionAssert.AreEquivalent(new[]
            {
                4.0,
                3.0,
                3.0,
                2.0
            }, transformed.Layers.Select(rl => rl.Top));
            Assert.AreEqual(0, transformed.Bottom);
        }
Пример #2
0
        public void Transform_SoilProfile2DWithMultipleLayersOnlyOuterLoop_ReturnsProfileWithBottomAndLayers()
        {
            // Setup
            const string profileName         = "SomeProfile";
            const long   pipingSoilProfileId = 1234L;

            var profile = new SoilProfile2D(pipingSoilProfileId, profileName,
                                            new List <SoilLayer2D>
            {
                SoilLayer2DTestFactory.CreateSoilLayer2D(
                    new List <Segment2D[]>(),
                    Segment2DLoopCollectionHelper.CreateFromString(
                        string.Join(Environment.NewLine,
                                    "10",
                                    "...",
                                    "...",
                                    "...",
                                    "...",
                                    "...",
                                    "...",
                                    "...",
                                    "1.2",
                                    "4.3",
                                    "..."))),
                SoilLayer2DTestFactory.CreateSoilLayer2D(
                    new List <Segment2D[]>(),
                    Segment2DLoopCollectionHelper.CreateFromString(
                        string.Join(Environment.NewLine,
                                    "10",
                                    "...",
                                    "...",
                                    "...",
                                    "...",
                                    "...",
                                    "4.3",
                                    "...",
                                    "1.2",
                                    "...",
                                    "..."))),
                SoilLayer2DTestFactory.CreateSoilLayer2D(
                    new List <Segment2D[]>(),
                    Segment2DLoopCollectionHelper.CreateFromString(
                        string.Join(Environment.NewLine,
                                    "10",
                                    "...",
                                    "1.2",
                                    "...",
                                    "...",
                                    "...",
                                    "4.3",
                                    "...",
                                    "...",
                                    "...",
                                    "...")))
            }, Enumerable.Empty <PreconsolidationStress>())
            {
                IntersectionX = 1.0
            };

            // Call
            PipingSoilProfile transformed = PipingSoilProfileTransformer.Transform(profile);

            // Assert
            Assert.AreEqual(profileName, transformed.Name);
            Assert.AreEqual(SoilProfileType.SoilProfile2D, transformed.SoilProfileSourceType);
            Assert.AreEqual(3, transformed.Layers.Count());
            CollectionAssert.AreEquivalent(new[]
            {
                2.0,
                4.0,
                8.0
            }, transformed.Layers.Select(rl => rl.Top));
            Assert.AreEqual(1.0, transformed.Bottom);
        }