Example #1
0
            static async Task GetOrderingPartyWithModelModel()
            {
                var context = OrderingPartyTestContext.Setup();

                var controller = context.OrderingPartyController;
                await controller.UpdateAsync("OrderId", null);
            }
Example #2
0
        public async Task GetAsync_GetOrderById_CalledOnce()
        {
            var context = OrderingPartyTestContext.Setup();

            var controller = context.OrderingPartyController;

            await controller.GetAsync(string.Empty);

            context.OrderRepositoryMock.Verify(x => x.GetOrderByIdAsync(string.Empty), Times.Once);
        }
Example #3
0
        public async Task GetAsync_OrderIdDoesNotExist_ReturnsNotFound()
        {
            var context = OrderingPartyTestContext.Setup();

            var controller = context.OrderingPartyController;

            var response = await controller.GetAsync("INVALID");

            response.Result.Should().BeOfType <NotFoundResult>();
        }
Example #4
0
        public async Task UpdateAsync_OrderIdDoesNotExist_ReturnNotFound(string orderId)
        {
            var context = OrderingPartyTestContext.Setup();

            var controller = context.OrderingPartyController;

            var response =
                await controller.UpdateAsync(orderId, new OrderingPartyModel { PrimaryContact = new PrimaryContactModel() });

            response.Should().BeEquivalentTo(new NotFoundResult());
        }
Example #5
0
        public async Task GetAsync_EmptyOrderingParty_ReturnsEmptyResult()
        {
            const string orderId = "C0000014-01";
            var          context = OrderingPartyTestContext.Setup();

            (Order order, OrderingPartyModel _) = CreateOrderingPartyTestData(orderId, context.PrimaryOrganisationId, false);

            context.Order = order;

            var controller = context.OrderingPartyController;

            var result = await controller.GetAsync(orderId);

            result.Result.Should().BeOfType <OkResult>();
        }
Example #6
0
        public async Task GetAsync_OrderIdExists_ReturnsTheOrderingParty()
        {
            const string orderId = "C0000014-01";
            var          context = OrderingPartyTestContext.Setup();

            (Order order, OrderingPartyModel expectedOrderingParty) = CreateOrderingPartyTestData(orderId, context.PrimaryOrganisationId);

            context.Order = order;

            var controller = context.OrderingPartyController;

            var result = await controller.GetAsync(orderId);

            result.Should()
            .BeEquivalentTo(new ActionResult <OrderingPartyModel>(new OkObjectResult(expectedOrderingParty)));
        }
Example #7
0
        public async Task GetAsync_WrongOrganisationId_ReturnsForbidden()
        {
            var context = OrderingPartyTestContext.Setup();

            const string orderId = "C0000014-01";

            (Order order, _) = CreateOrderingPartyTestData(orderId, Guid.NewGuid());

            context.Order = order;

            var controller = context.OrderingPartyController;

            var result = await controller.GetAsync(orderId);

            result.Result.Should().BeOfType <ForbidResult>();
        }