Exemplo n.º 1
0
        public void ShouldNotBeAbleToSetValuesAfterActivatingButBeforeMarketOrderAccepted()
        {
            const decimal totalQ = 25;
            const decimal clipQ  = 10;

            var expected   = DefaultFakeOrderRecord(quantity: totalQ);
            var mockServer = new Mock <IServerFacade>();

            mockServer.Setup(s => s.CreateOrder(It.IsAny <OrderRecord>())).Returns(true);

            const decimal priceDelta = 0;
            var           iceberg    = new IcebergOrder(mockServer.Object,
                                                        expected.Symbol,
                                                        expected.ClOrdID,
                                                        expected.Side,
                                                        expected.Quantity,
                                                        clipQ,
                                                        expected.Price,
                                                        priceDelta);

            Assert.IsTrue(iceberg.CanSetNewValues(),
                          "Should be able to set values before activating");

            iceberg.Activate();

            Assert.IsFalse(iceberg.CanSetNewValues(),
                           "Should not be able to set values before market order is accepted");
        }
Exemplo n.º 2
0
        public void CanSetNewValuesIfOrderNotYetActivated()
        {
            const decimal totalQ = 25;
            const decimal clipQ  = 10;

            var expected   = DefaultFakeOrderRecord(quantity: totalQ);
            var mockServer = new Mock <IServerFacade>();

            const decimal priceDelta = 0;
            var           iceberg    = new IcebergOrder(mockServer.Object,
                                                        expected.Symbol,
                                                        expected.ClOrdID,
                                                        expected.Side,
                                                        expected.Quantity,
                                                        clipQ,
                                                        expected.Price,
                                                        priceDelta);

            mockServer.Verify(s => s.CreateOrder(It.IsAny <OrderRecord>()), Times.Never());

            Assert.IsTrue(iceberg.CanSetNewValues(),
                          "Should be able to set values before activating");
        }