public void Negate_ReturnsOptionPosition_WithSameSymbolAndNegativeQuantity() { var position = new OptionPosition(Symbols.SPY, 42); var negated = position.Negate(); Assert.AreEqual(position.Symbol, negated.Symbol); Assert.AreEqual(-position.Quantity, negated.Quantity); }
public void SubtractionOperator_DoesNotThrow_WhenOneSideEqualsDefault() { var value = new OptionPosition(Symbols.SPY, 42); var defaultValue = default(OptionPosition); var valueFirst = value - defaultValue; var defaultFirst = defaultValue - value; Assert.AreEqual(value, valueFirst); Assert.AreEqual(value.Negate(), defaultFirst); }
public void Equality_IsDefinedUsing_SymbolAndQuantity() { var left = new OptionPosition(Symbols.SPY, 42); var right = new OptionPosition(Symbols.SPY, 42); Assert.AreEqual(left, right); Assert.IsTrue(left == right); right = right.Negate(); Assert.AreNotEqual(left, right); Assert.IsTrue(left != right); }