Exemplo n.º 1
0
        public async Task Cancel_order_with_requestId_bad_requestAsync()
        {
            this._mediatorMock.Setup(m => m.Send(It.IsAny <IdentifiedCommand <CancelOrderCommand, bool> >(), default(CancellationToken)))
            .Returns(Task.FromResult(false));

            var orderController       = new OrdersController(this._mediatorMock.Object, this._orderQueriesMock.Object, this._identityServiceMock.Object);
            BadRequestResult response = await orderController.CancelOrderAsync(new CancelOrderCommand(1), Guid.NewGuid().ToString()) as BadRequestResult;

            Assert.Equal(response.StatusCode, (int)System.Net.HttpStatusCode.BadRequest);
        }
Exemplo n.º 2
0
        public async Task Cancel_order_bad_request()
        {
            //Arrange
            _mediatorMock.Setup(x => x.Send(It.IsAny <IdentifiedCommand <CancelOrderCommand, bool> >(), default(CancellationToken)))
            .Returns(Task.FromResult(true));

            //Act
            var orderController = new OrdersController(_mediatorMock.Object, _orderQueriesMock.Object, _identityServiceMock.Object, _loggerMock.Object);
            var actionResult    = await orderController.CancelOrderAsync(new CancelOrderCommand(1), String.Empty) as BadRequestResult;

            //Assert
            Assert.Equal(actionResult.StatusCode, (int)System.Net.HttpStatusCode.BadRequest);
        }
        public async Task Create_order_with_requestId_success()
        {
            //Arrange
            _mediatorMock.Setup(x => x.Send(It.IsAny <IdentifiedCommand <CancelOrderCommand, bool> >(), default(CancellationToken)))
            .Returns(Task.FromResult(true));

            //Act
            var orderController = new OrdersController(_mediatorMock.Object, _orderQueriesMock.Object, _identityServiceMock.Object);
            var actionResult    = await orderController.CancelOrderAsync(new CancelOrderCommand(1), Guid.NewGuid().ToString()) as OkResult;

            //Assert
            Assert.Equal(actionResult.StatusCode, (int)System.Net.HttpStatusCode.OK);
        }