public void FailWhenGivenANegativeInteger() { var function = new FactorialFunction(); var inputs = function.GetInputs(); Assert.Throws <ArgumentException>(() => { inputs[0].Value = -5; }); }
public void SuccessfullyReturnValueGivenAPositiveDouble() { var function = new FactorialFunction(); var inputs = function.GetInputs(); inputs[0].Value = 5.5; var result = function.Calculate(inputs); Assert.NotNull(result); Assert.Collection(result, i => { Assert.Equal(typeof(double), i.Value.GetType()); Assert.Equal(287.88527781504507, TypeConverter.ToObject <double>(i.Value)); }); }
public void SuccessfullyReturnValueGivenAPositiveInteger() { var function = new FactorialFunction(); 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(120, TypeConverter.ToObject <int>(i.Value)); }); }