public async Task TestIfGetPageReturnsNull(string pageName) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var categoryPagesService = new Areas.Administration.Services.AdminCategoryPagesServices(context); var result = await categoryPagesService.GetPageAsync(pageName); Assert.Null(result); }
public async Task TestIfGetPageReturnsCorrectResult(string pageName) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var categoryPagesService = new Areas.Administration.Services.AdminCategoryPagesServices(context); await context.Pages.AddAsync(new Page { PageName = pageName, }); await context.SaveChangesAsync(); var result = await categoryPagesService.GetPageAsync(pageName); Assert.NotNull(result); Assert.Equal(pageName, result.PageName); }