public static async Task GetOrderDescription_ReturnsNull(
            CallOffId callOffId,
            OrderDescriptionService service)
        {
            var result = await service.GetOrderDescription(callOffId);

            result.Should().BeNull();
        }
        public static async Task SetOrderDescription_UpdatesOrderDescription(
            Order order,
            string description,
            OrderDescriptionService service)
        {
            order.Description.Should().NotBe(description);

            await service.SetOrderDescription(order, description);

            order.Description.Should().Be(description);
        }
        public static async Task GetOrderDescription_ReturnsOrderDescription(
            [Frozen] ApplicationDbContext context,
            Order order,
            OrderDescriptionService service)
        {
            context.Order.Add(order);
            await context.SaveChangesAsync();

            var expectedResult = order.Description;

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

            Assert.NotNull(result);
            result.Should().Be(expectedResult);
        }
        public static async Task SetOrderDescription_SavesToDb(
            [Frozen] ApplicationDbContext context,
            Order order,
            string description,
            OrderDescriptionService service)
        {
            context.Order.Add(order);
            await context.SaveChangesAsync();

            order.Description.Should().NotBe(description);

            await service.SetOrderDescription(order, description);

            var expectedOrder = context.Set <Order>().First(o => o.Equals(order));

            expectedOrder.Description.Should().Be(description);
        }
 public static void SetOrderDescription_NullOrderDescription_ThrowsException(
     Order order,
     OrderDescriptionService service)
 {
     Assert.ThrowsAsync <ArgumentNullException>(async() => await service.SetOrderDescription(order, null));
 }
 public static void SetOrderDescription_NullOrder_ThrowsException(
     string description,
     OrderDescriptionService service)
 {
     Assert.ThrowsAsync <ArgumentNullException>(async() => await service.SetOrderDescription(null, description));
 }
 public static void Constructor_NullHttpContextAccessor_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => _ = new OrderDescriptionService(null));
 }