public void PostSell_InsteadOfBuy_ReturnsBadRequest() { var matcherMock = new Mock <IOrderMatcher>(); var currentOrder = new Order(1001, 45, 55, OrderType.Sell, 14); var controller = new OrdersController(matcherMock.Object); var controllerResponse = controller.Buy(currentOrder); var objectResponse = controllerResponse as BadRequestResult; Assert.Equal(400, objectResponse.StatusCode); }
public void PostBuy_ReturnsOkStatus_NoTrade() { var matcherMock = new Mock <IOrderMatcher>(); var currentOrder = new Order(1001, 45, 55, OrderType.Buy, 14); matcherMock.Setup(matcher => matcher.ProcessOrder(currentOrder)).Returns(false); var controller = new OrdersController(matcherMock.Object); var controllerResponse = controller.Buy(currentOrder); var objectResponse = controllerResponse as OkObjectResult; Assert.Equal(200, objectResponse.StatusCode); Assert.Equal("Match not found, Order added to Existing Orders", objectResponse.Value); }