示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }