Exemple #1
0
        public static async Task GetAllOrderItemRecipient_ReturnsNull(
            CallOffId callOffId,
            ServiceRecipientService service)
        {
            var result = await service.GetAllOrderItemRecipients(callOffId);

            result.Should().BeNull();
        }
Exemple #2
0
        public static async Task GetAllOrderItemRecipient_ReturnsEmptyList(
            [Frozen] ApplicationDbContext context,
            Order order,
            ServiceRecipientService service)
        {
            context.Order.Add(order);
            await context.SaveChangesAsync();

            var result = await service.GetAllOrderItemRecipients(order.CallOffId);

            result.Should().BeEmpty();
        }
Exemple #3
0
        public static async Task GetAllOrderItemRecipient_ReturnsOrderItemRecipients(
            [Frozen] ApplicationDbContext context,
            [Frozen] Order order,
            OrderItem orderItem,
            List <OrderItemRecipient> orderItemRecipients,
            ServiceRecipientService service)
        {
            orderItem.SetRecipients(orderItemRecipients);
            order.AddOrUpdateOrderItem(orderItem);
            context.Order.Add(order);
            await context.SaveChangesAsync();

            var expectedServiceRecipients =
                orderItemRecipients.Select(o => new ServiceRecipient(o.Recipient.OdsCode, o.Recipient.Name));

            var result = await service.GetAllOrderItemRecipients(order.CallOffId);

            result.Should().BeEquivalentTo(expectedServiceRecipients);
        }