public void MapperTest(double[] values, double centerValue, double mappedValue) { var mapper = new InputMapperCollection { CenterPoint = centerValue, }; double result = mapper.GetValue(values); Assert.AreEqual(mappedValue, result); }
private Func <double> CreateGetter(Dictionary <string, IInputDevice> deviceLookup, InputMapperCollection collection, double defaultValue) { var sources = collection.Mappers .Where(m => deviceLookup.ContainsKey(m.Device)) .Select(m => deviceLookup[m.Device].FindSource(m.InputId)) .Where(s => s != null) .ToArray(); if (sources.Length == 0) { return(() => defaultValue); } return(() => { return collection.GetValue(sources.Select(s => s.GetValue())); }); }