public async Task TestIfEditBoxesThrowsError()
        {
            var context = PCHUBDbContextInMemoryInitializer.InitializeContext();

            var categoryPagesService = new Areas.Administration.Services.AdminCategoryPagesServices(context);

            await Assert.ThrowsAsync <NullReferenceException>(async() =>
            {
                var form = new EditBoxesViewModel();

                await categoryPagesService.EditBoxesAsync(form);
            });
        }
        public async Task TestIfEditBoxesWorksAccordingly(string pageName, string href, string text,
                                                          string color)
        {
            var context = PCHUBDbContextInMemoryInitializer.InitializeContext();

            var categoryPagesService = new Areas.Administration.Services.AdminCategoryPagesServices(context);

            await context.Pages.AddAsync(new Page
            {
                PageName      = pageName,
                ColorfulBoxes = new List <ColorfulBox>(),
            });

            await context.SaveChangesAsync();

            var model = new AddBoxViewModel();

            model.Color    = color;
            model.Href     = href;
            model.Text     = text;
            model.PageName = pageName;

            await categoryPagesService.AddBoxAsync(model);

            var boxModel = new EditBoxesViewModel();

            boxModel.PageName = pageName;
            boxModel.Boxes    = new List <EditBoxViewModel>
            {
                new EditBoxViewModel
                {
                    Color = "edited",
                    Href  = "edited",
                    Text  = "edited",
                }
            };

            await categoryPagesService.EditBoxesAsync(boxModel);

            var result = await categoryPagesService.GetAllBoxesForPageAsync(pageName);

            Assert.NotEmpty(result);

            Assert.Contains(result, (x) => x.Href == "edited" && x.Color == "edited" && x.Text == "edited");
        }