예제 #1
0
        public void FailWhenGivenANegativeInteger()
        {
            var function = new GammaFunction();

            var inputs = function.GetInputs();

            Assert.Throws <ArgumentException>(() =>
            {
                inputs[0].Value = -5;
            });
        }
예제 #2
0
        public void SuccessfullyReturnValueGivenAPositiveInteger()
        {
            var function = new GammaFunction();

            var inputs = function.GetInputs();

            Assert.Single(inputs);

            inputs[0].Value = 5;

            var result = function.Calculate(inputs);

            Assert.NotNull(result);
            Assert.Collection(result,
                              i =>
            {
                Assert.Equal(typeof(double), i.Value.GetType());
                Assert.Equal(24, TypeConverter.ToObject <int>(i.Value));
            });
        }
예제 #3
0
        public void SuccessfullyReturnNaNGivenZero()
        {
            var function = new GammaFunction();

            var inputs = function.GetInputs();

            Assert.Single(inputs);

            inputs[0].Value = 0;

            var result = function.Calculate(inputs);

            Assert.NotNull(result);
            Assert.Collection(result,
                              i =>
            {
                Assert.Equal(typeof(double), i.Value.GetType());
                Assert.True(Double.IsNaN(TypeConverter.ToObject <double>(i.Value)));
            });
        }