/// <inheritdoc /> public ECPoint Add(ECPoint left, ECPoint right) { using (var ctx = BigNumberContextHandle.Create()) { var res = new ECPoint(Handle); ECPointHandle.Add(Handle, res.Handle, left.Handle, right.Handle, ctx); return(res); } }
public void TestEqualsAndHash() { var point = new ECPoint(groupHandle, rawPointHandle); var equalPoint = new ECPoint(groupHandle, rawPointHandle); Assert.That(!point.Handle.Equals(equalPoint.Handle), "Distinct points share same handle!"); Assert.That(point.Equals(equalPoint), "Equal points are not seen as equal!"); Assert.That(point.GetHashCode().Equals(equalPoint.GetHashCode()), "Equals points do not share same hash code!"); var unequalPoint = new ECPoint(groupHandle); ECPointHandle.Add(groupHandle, unequalPoint.Handle, rawPointHandle, rawPointHandle, ctx); Assert.That(!point.Equals(unequalPoint), "Unequal points are seen as equal!"); Assert.That(!point.Equals(new {}), "Point equal to anonymous object!"); }