public void FailWhenGivenDivisorOfZero() { var function = new ModuloFunction(); var inputs = function.GetInputs(); Assert.Throws <DivideByZeroException>(() => { inputs[0].Value = 17; inputs[1].Value = 0; }); }
public void SuccessfullySetFunctionInfo() { var function = new ModuloFunction(); Assert.NotNull(function.FunctionInfo); Assert.Equal("Modulo", function.FunctionInfo.Name); Assert.Equal(new Version("1.0.0"), function.FunctionInfo.Version); Assert.Equal("Find the C# standard remainder of two numbers.", function.FunctionInfo.Description); Assert.Collection(function.FunctionInfo.Tags, i => Assert.Equal("algebra", i), i => Assert.Equal("modulo", i), i => Assert.Equal("remainder", i)); }
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)); }); }
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)); }); }