public void SuspendWhenAlreadySuspendedThrows() { const string orderID = "FakeOrderID"; var expected = DefaultFakeOrderRecord(); var mockServer = new Mock <IServerFacade>(); mockServer.Setup(s => s.CreateOrder(It.IsAny <OrderRecord>())).Returns(true); mockServer.Setup(s => s.CancelOrder(expected.Symbol, expected.ClOrdID, expected.Side, orderID)) .Returns(true); var clipSize = expected.Quantity; const decimal priceDelta = 0; var iceberg = new IcebergOrder(mockServer.Object, expected.Symbol, expected.ClOrdID, expected.Side, expected.Quantity, clipSize, expected.Price, priceDelta); iceberg.Activate(); mockServer.Verify(s => s.CreateOrder(It.IsAny <OrderRecord>()), Times.Once()); iceberg.ActivatedMarketOrderAccepted(orderID); Assert.AreEqual(IcebergOrder.ActivationState.Active, iceberg.State, "Order should be active"); iceberg.Suspend(); iceberg.MarketOrderCanceled(); Assert.AreEqual(IcebergOrder.ActivationState.Suspended, iceberg.State, "Order should be suspended"); Assert.Throws <ApplicationException>(iceberg.Suspend); mockServer.Verify( s => s.CancelOrder(expected.Symbol, expected.ClOrdID, expected.Side, orderID), Times.Once()); Assert.AreEqual(IcebergOrder.ActivationState.Suspended, iceberg.State, "Order should be suspended"); }