public void CalculateTheCorrectOutput_WhenValidDoubleArgumentsArePassed(double seed, double output) { var evaluator = new Evaluator <double>(); evaluator.Add((val, _) => val / 2); evaluator.Add((val, additionalVals) => val + additionalVals[0], 5); evaluator.Add((val, additionalVals) => val + 1 + additionalVals[0], 20); evaluator.Add((val, additionalVals) => val - additionalVals[0] - additionalVals[1], 5, 3); evaluator.Evaluate(seed).Should().Be(output); }
public void ThrowDivideByZeroException_WhenDivideByZeroOperationIsAttempted() { var evaluator = new Evaluator <int>(); evaluator.Add((val, _) => val / 0); Assert.Throws <DivideByZeroException>(() => evaluator.Evaluate(8)); }
private static void EvaluateFileExtension(VfsFile file, Evaluator evaluator) { var extension = Path.GetExtension(file.FullPath); foreach (var type in FileTypeDatabase.GetFileTypesByExtension(extension)) { evaluator.Add(type, POINTS_EXTENSION); } }
public void DoesNotThrowArgumentNullException_WhenNullArgsIsPassed() { var evaluator = new Evaluator <int>(); Assert.DoesNotThrow(() => evaluator.Add((val, _) => val / 4)); }
public void ThrowArgumentNullException_WhenNullFuncIsPassed() { var evaluator = new Evaluator <int>(); Assert.Throws <ArgumentNullException>(() => evaluator.Add(null, 1)); }