public static async Task GetOrder_ReturnsNull(
            CallOffId callOffId,
            SectionStatusService service)
        {
            var result = await service.GetOrder(callOffId);

            result.Should().BeNull();
        }
        public static async Task GetOrder_ReturnsOrder(
            [Frozen] ApplicationDbContext context,
            Order order,
            SectionStatusService service)
        {
            context.Order.Add(order);
            await context.SaveChangesAsync();

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

            result.Should().BeEquivalentTo(order);
        }
        public static async Task SetSectionStatus_WithSectionId_UpdatesTheSelectedStatus(
            string sectionId,
            bool additionalServicesViewed,
            bool catalogueSolutionsViewed,
            bool associatedServicesViewed,
            Order order,
            SectionStatusService service)
        {
            order.Progress.AdditionalServicesViewed = false;
            order.Progress.AssociatedServicesViewed = false;
            order.Progress.CatalogueSolutionsViewed = false;

            await service.SetSectionStatus(order, sectionId);

            order.Progress.AdditionalServicesViewed.Should().Be(additionalServicesViewed);
            order.Progress.AssociatedServicesViewed.Should().Be(associatedServicesViewed);
            order.Progress.CatalogueSolutionsViewed.Should().Be(catalogueSolutionsViewed);
        }
        public static async Task SetSectionStatus_WithSectionId_SavesToDb(
            string sectionId,
            bool additionalServicesViewed,
            bool catalogueSolutionsViewed,
            bool associatedServicesViewed,
            [Frozen] ApplicationDbContext context,
            Order order,
            SectionStatusService service)
        {
            context.Order.Add(order);
            await context.SaveChangesAsync();

            order.Progress.AdditionalServicesViewed = false;
            order.Progress.AssociatedServicesViewed = false;
            order.Progress.CatalogueSolutionsViewed = false;

            await service.SetSectionStatus(order, sectionId);

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

            expectedOrder.Progress.AdditionalServicesViewed.Should().Be(additionalServicesViewed);
            expectedOrder.Progress.AssociatedServicesViewed.Should().Be(associatedServicesViewed);
            expectedOrder.Progress.CatalogueSolutionsViewed.Should().Be(catalogueSolutionsViewed);
        }
 public static void SetSectionStatus_NullSectionId_ThrowsException(
     Order order,
     SectionStatusService service)
 {
     Assert.ThrowsAsync <ArgumentNullException>(async() => await service.SetSectionStatus(order, null));
 }
 public static void SetSectionStatus_NullOrder_ThrowsException(
     string sectionId,
     SectionStatusService service)
 {
     Assert.ThrowsAsync <ArgumentNullException>(async() => await service.SetSectionStatus(null, sectionId));
 }
 public static void Constructor_NullAccessor_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => _ = new SectionStatusService(null));
 }