コード例 #1
0
        public void Create_SoilProfileNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => PersistableSoilLayerCollectionFactory.Create(null, new IdFactory(), new MacroStabilityInwardsExportRegistry());

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

            Assert.AreEqual("soilProfile", exception.ParamName);
        }
コード例 #2
0
        public void Create_RegistryNull_ThrowsArgumentNullException()
        {
            // Setup
            var mocks       = new MockRepository();
            var soilProfile = mocks.Stub <IMacroStabilityInwardsSoilProfileUnderSurfaceLine>();

            mocks.ReplayAll();

            // Call
            void Call() => PersistableSoilLayerCollectionFactory.Create(soilProfile, new IdFactory(), null);

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

            Assert.AreEqual("registry", exception.ParamName);
            mocks.VerifyAll();
        }
コード例 #3
0
        public void Create_WithValidData_ReturnsPersistableSoilLayerCollectionCollection()
        {
            // Setup
            var soilProfile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(
                new[]
            {
                MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D(new[]
                {
                    MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D()
                })
            },
                Enumerable.Empty <IMacroStabilityInwardsPreconsolidationStress>());

            var idFactory = new IdFactory();
            var registry  = new MacroStabilityInwardsExportRegistry();

            PersistableSoilCollection         soils      = PersistableSoilCollectionFactory.Create(soilProfile, idFactory, registry);
            IEnumerable <PersistableGeometry> geometries = PersistableGeometryFactory.Create(soilProfile, idFactory, registry);

            // Call
            IEnumerable <PersistableSoilLayerCollection> soilLayerCollections = PersistableSoilLayerCollectionFactory.Create(soilProfile, idFactory, registry);

            // Assert
            PersistableDataModelTestHelper.AssertPersistableSoilLayers(soilProfile.Layers, soilLayerCollections, soils.Soils, geometries);

            var stages = new[]
            {
                MacroStabilityInwardsExportStageType.Daily,
                MacroStabilityInwardsExportStageType.Extreme
            };

            Assert.AreEqual(2, registry.SoilLayers.Count);

            for (var i = 0; i < stages.Length; i++)
            {
                Assert.AreEqual(registry.SoilLayers[stages[i]], soilLayerCollections.ElementAt(i).Id);
            }
        }