Пример #1
0
        public async Task CreateUnauthorizedExceptionHappenedExpect401()
        {
            var deliveryDto = new DeliveryDto();

            _mockDeliveryService.Setup(service => service.Create(_mockExecutionContext.Object, deliveryDto))
            .Throws <UnauthorizedException>();

            var result = await _deliveriesController.Create(deliveryDto);

            Assert.IsType <StatusCodeResult>(result);

            var statusCodeResult = (StatusCodeResult)result;

            Assert.Equal(401, statusCodeResult.StatusCode);
        }