Ejemplo n.º 1
0
        public ThumbnailIconControllerFixture()
        {
            var partialDirectory = $"[appDataPath]\\thumb_cache\\{Guid.NewGuid()}\\";

            ConfigurationManager.AppSettings["FontThumbnail.CachePath"] = partialDirectory;
            _temporaryDirectory = VirtualPathUtilityEx.RebasePhysicalPath(partialDirectory);

            Directory.CreateDirectory(_temporaryDirectory);

            var service = new FontThumbnailService();

            Controller = new ThumbnailIconController(service);
            Settings   = new ThumbnailSettings
            {
                FontSize        = Constants.DefaultFontSize,
                BackgroundColor = Constants.DefaultBackgroundColor,
                ForegroundColor = Constants.DefaultForegroundColor,
                Height          = Constants.DefaultHeight,
                Width           = Constants.DefaultWidth
            };
        }
        public void TestGenerateThumbnail_FontAwesome5Solid()
        {
            // Arrange
            var service    = new FontThumbnailService();
            var controller = new ThumbnailIconController(service);
            var values     = (FontAwesome5Solid[])Enum.GetValues(typeof(FontAwesome5Solid));
            var settings   = new Settings.ThumbnailSettings
            {
                FontSize        = Constants.DefaultFontSize,
                BackgroundColor = Constants.DefaultBackgroundColor,
                ForegroundColor = Constants.DefaultForegroundColor,
                Height          = Constants.DefaultHeight,
                Width           = Constants.DefaultWidth,
                EmbeddedFont    = "fa-solid-900.ttf"
            };

            // Act
            foreach (var item in values)
            {
                settings.Character = (int)item;
                //var image = service.GenerateImage(settings);
                var result = controller.GenerateThumbnail(settings) as ImageResult;
            }
        }