Beispiel #1
0
        public async Task ShouldCreateTheme()
        {
            // Arrange
            using var context = ContextFactory.Create();
            var themeController = ThemeControllerFactory.Create(context);

            // Act
            await themeController.Create(ThemeModelDefault.ThemeWithChildren);

            // Assert
            var actualTheme = context.Themes.FirstOrDefault();

            ThemeAssert.Assert(expectedTheme: ThemeDefault.ThemeWithChildren, actualTheme);
        }
Beispiel #2
0
        public async Task ShouldDeleteTheme()
        {
            // Arrange
            using var context = ContextFactory.Create();
            var themeController = ThemeControllerFactory.Create(context);

            await context.InsertTheme(ThemeDefault.ThemeWithChildren);

            var themeId = (await context.Themes.FirstOrDefaultAsync()).Id;

            // Act
            await themeController.Delete(themeId);

            // Assert
            Assert.False(context.Themes.Any(t => t.Id == themeId),
                         message: $"The theme id {themeId} should be deleted.");
        }
Beispiel #3
0
        public async Task ShouldGetThemes()
        {
            // Arrange
            using var context = ContextFactory.Create();
            var themeController = ThemeControllerFactory.Create(context);
            var expectedThemes  = new [] { ThemeDefault.ThemeWithChildren };

            await context.InsertTheme(expectedThemes);

            // Act
            var result = await themeController.Get(includeChildren : true);

            // Assert
            var actualThemes = result.Value;

            ThemeAssert.Assert(expectedThemes, actualThemes);
        }