Beispiel #1
0
        public void ParameteredConstructor_ExpectedValues()
        {
            // Setup
            var mocks        = new MockRepository();
            var distribution = mocks.StrictMock <IDistribution>();

            mocks.ReplayAll();

            // Call
            var designVariable = new SimpleDesignVariable(distribution);

            // Assert
            Assert.AreSame(distribution, designVariable.Distribution);
            mocks.VerifyAll(); // Expect no calls on mocks
        }
Beispiel #2
0
        public void Percentile_SettingValidValue_PropertySet(double validPercentile)
        {
            // Setup
            var mocks        = new MockRepository();
            var distribution = mocks.StrictMock <IDistribution>();

            mocks.ReplayAll();

            var designVariable = new SimpleDesignVariable(distribution);

            // Call
            designVariable.Percentile = validPercentile;

            // Assert
            Assert.AreEqual(validPercentile, designVariable.Percentile);
            mocks.VerifyAll(); // Expect no calls on mocks
        }
Beispiel #3
0
        public void Percentile_SettingInvalidValue_ThrowArgumentOutOfRangeException(double invalidPercentile)
        {
            // Setup
            var mocks        = new MockRepository();
            var distribution = mocks.StrictMock <IDistribution>();

            mocks.ReplayAll();

            var designVariable = new SimpleDesignVariable(distribution);

            // Call
            TestDelegate call = () => designVariable.Percentile = invalidPercentile;

            // Assert
            var    exception         = Assert.Throws <ArgumentOutOfRangeException>(call);
            string customMessagePart = exception.Message.Split(new[]
            {
                Environment.NewLine
            }, StringSplitOptions.RemoveEmptyEntries)[0];

            Assert.AreEqual("Percentiel moet in het bereik [0,0, 1,0] liggen.", customMessagePart);
            mocks.VerifyAll(); // Expect no calls on mocks
        }
Beispiel #4
0
        public void Distribution_SetToNull_ThrowArgumentNullException()
        {
            // Setup
            var mocks        = new MockRepository();
            var distribution = mocks.StrictMock <IDistribution>();

            mocks.ReplayAll();

            var designVariable = new SimpleDesignVariable(distribution);

            // Call
            TestDelegate call = () => designVariable.Distribution = null;

            // Assert
            var    exception         = Assert.Throws <ArgumentNullException>(call);
            string customMessagePart = exception.Message.Split(new[]
            {
                Environment.NewLine
            }, StringSplitOptions.None)[0];

            Assert.AreEqual("Een kansverdeling moet opgegeven zijn om op basis van die data een rekenwaarde te bepalen.", customMessagePart);
            mocks.VerifyAll(); // Expect no calls on mocks
        }