public CubePoint(ValueMapper valueMapper, KeyValuePair <uint [], TValueType> kvp) { if (valueMapper == null) { throw new ArgumentNullException(nameof(valueMapper)); } this._valueMapper = valueMapper; this._kvp = kvp; }
public void StandardObject() { var valueMapper = new ValueMapper(); var myObj = new object(); var id = valueMapper.GetID(myObj); var myObj2 = valueMapper.GetObject(id); Assert.AreSame(myObj, myObj2); }
public void NullHandling() { var valueMapper = new ValueMapper(); var id = valueMapper.GetID(null); var obj = valueMapper.GetObject(id); Assert.IsNull(obj); }
/// <summary> /// Creates a new instance of the error. /// </summary> /// <remarks>This method will take a reference to the existing <paramref name="valueMapper"/> and /// <paramref name="axisNames"/> parameters, but will copy the <paramref name="errorKeys"/> array. /// This is necessary to simplify the initial construction of the underlying array</remarks> /// <param name="valueMapper"></param> /// <param name="axisNames"></param> /// <param name="errorKeys"></param> /// <param name="errorMessage"></param> public Error(ValueMapper valueMapper, string [] axisNames, uint? [] errorKeys, string errorMessage) { _valueMapper = valueMapper; _axisNames = axisNames; this.ErrorMessage = errorMessage; _errorKeys = new uint? [errorKeys.Length]; for (int i = 0; i < errorKeys.Length; i++) { _errorKeys [i] = errorKeys [i]; } }
public void StandardObjectAndNull() { var valueMapper = new ValueMapper(); var myObj = new object(); var id = valueMapper.GetID(myObj); var nullID = valueMapper.GetID(null); var myObj2 = valueMapper.GetObject(id); Assert.AreSame(myObj, myObj2); Assert.AreNotEqual(nullID, id); }
/// <summary> /// Creates a new instance of <see cref="ErrorSet"/> /// </summary> /// <param name="valueMapper">The value mapper to use to encode values</param> /// <param name="axisNames">THe set of axes that can be used to key errors on</param> public ErrorSet(ValueMapper valueMapper, string [] axisNames) { if (valueMapper == null) { throw new ArgumentNullException(nameof(valueMapper)); } if (axisNames == null) { throw new ArgumentNullException(nameof(axisNames)); } this._valueMapper = valueMapper; this._axisNames = axisNames; this._errorsDictionary = new Dictionary.HybridErrorsDictionary(_axisNames); }
public void ProcessLargeNumbers() { var valueMapper = new ValueMapper(); var dict = new Dictionary <string, uint>(); for (int i = 0; i < 2000000; i++) { string s = i.ToString(); dict [s] = valueMapper.GetID(s); } foreach (var kvp in dict) { var returnedID = valueMapper.GetID(kvp.Key); Assert.AreEqual(kvp.Value, returnedID); Assert.AreEqual(kvp.Key, valueMapper.GetObject(returnedID)); } }