public void Transform_StochasticSoilProfileNull_ThrowsArgumentNullException()
        {
            // Setup
            var mocks       = new MockRepository();
            var soilProfile = mocks.Stub <IMacroStabilityInwardsSoilProfile <IMacroStabilityInwardsSoilLayer> >();

            mocks.ReplayAll();

            // Call
            TestDelegate call = () => MacroStabilityInwardsStochasticSoilProfileTransformer.Transform(null, soilProfile);

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

            Assert.AreEqual("stochasticSoilProfile", exception.ParamName);
            mocks.VerifyAll();
        }
        public void Transform_SoilProfileNull_ThrowsArgumentNullException()
        {
            // Setup
            var mocks       = new MockRepository();
            var soilProfile = mocks.Stub <ISoilProfile>();

            mocks.ReplayAll();

            StochasticSoilProfile stochasticSoilProfile = StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(soilProfile);

            // Call
            TestDelegate call = () => MacroStabilityInwardsStochasticSoilProfileTransformer.Transform(stochasticSoilProfile, null);

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

            Assert.AreEqual("soilProfile", exception.ParamName);
            mocks.VerifyAll();
        }
        public void Transform_InvalidStochasticSoilProfile_ThrowsImportedDataTransformException()
        {
            // Setup
            var mocks       = new MockRepository();
            var soilProfile = mocks.Stub <ISoilProfile>();
            var macroStabilityInwardsSoilProfile = mocks.Stub <IMacroStabilityInwardsSoilProfile <IMacroStabilityInwardsSoilLayer> >();

            mocks.ReplayAll();

            var stochasticSoilProfile = new StochasticSoilProfile(double.NaN, soilProfile);

            // Call
            TestDelegate call = () => MacroStabilityInwardsStochasticSoilProfileTransformer.Transform(stochasticSoilProfile, macroStabilityInwardsSoilProfile);

            // Assert
            var exception = Assert.Throws <ImportedDataTransformException>(call);

            Exception innerException = exception.InnerException;

            Assert.IsInstanceOf <ArgumentException>(innerException);
            Assert.AreEqual(innerException.Message, exception.Message);
        }
        public void Transform_ValidData_ReturnExpectedMacroStabilityInwardsStochasticSoilProfile()
        {
            // Setup
            var random = new Random(21);

            var mocks       = new MockRepository();
            var soilProfile = mocks.Stub <ISoilProfile>();
            var macroStabilityInwardsSoilProfile = mocks.Stub <IMacroStabilityInwardsSoilProfile <IMacroStabilityInwardsSoilLayer> >();

            mocks.ReplayAll();

            var stochasticSoilProfile = new StochasticSoilProfile(random.NextDouble(), soilProfile);

            // Call
            MacroStabilityInwardsStochasticSoilProfile macroStabilityInwardsStochasticSoilProfile
                = MacroStabilityInwardsStochasticSoilProfileTransformer.Transform(stochasticSoilProfile, macroStabilityInwardsSoilProfile);

            // Assert
            Assert.AreEqual(stochasticSoilProfile.Probability, macroStabilityInwardsStochasticSoilProfile.Probability);
            Assert.AreSame(macroStabilityInwardsSoilProfile, macroStabilityInwardsStochasticSoilProfile.SoilProfile);
            mocks.VerifyAll();
        }