Exemplo n.º 1
0
        public void FailWhenGivenDivisorOfZero()
        {
            var function = new ModuloFunction();

            var inputs = function.GetInputs();

            Assert.Throws <DivideByZeroException>(() =>
            {
                inputs[0].Value = 17;
                inputs[1].Value = 0;
            });
        }
Exemplo n.º 2
0
        public void SuccessfullyReturnWithDefaultValues()
        {
            var function = new ModuloFunction();

            var inputs = function.GetInputs();

            Assert.Equal(2, inputs.Length);

            var result = function.Calculate(inputs);

            Assert.Collection(result,
                              i =>
            {
                Assert.Equal(typeof(double), i.Value.GetType());
                Assert.Equal(0, TypeConverter.ToObject <int>(i.Value));
            });
        }
Exemplo n.º 3
0
        public void SuccessfullyReturnValueGivenDividendIsEqualToDivisor()
        {
            var function = new ModuloFunction();

            var inputs = function.GetInputs();

            Assert.Equal(2, inputs.Length);

            inputs[0].Value = 17;
            inputs[1].Value = 17;

            var result = function.Calculate(inputs);

            Assert.Collection(result,
                              i =>
            {
                Assert.Equal(typeof(double), i.Value.GetType());
                Assert.Equal(0, TypeConverter.ToObject <int>(i.Value));
            });
        }