Пример #1
0
        public void FontLoader_FindCorrectPartialMatchesInFileResources_FindsTheRightNumber()
        {
            var appAssembly       = Substitute.For <IApplicationAssembly>();
            var fontsAssembly     = Substitute.For <IFontsAssembly>();
            var filesystem        = Substitute.For <IFileSystem>();
            var messenger         = Substitute.For <IFrameworkMessenger>();
            var properties        = Substitute.For <IStartupPropertiesCache>();
            var subFontGenerator  = Substitute.For <ISubFontGenerator>();
            var gpuSurfaceManager = Substitute.For <IGpuSurfaceManager>();

            filesystem.GetFilesInDirectory(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <SearchOption>()).Returns(new string[]
            {
                "partial/testi/iqueend0.fnt",
                "no/match/here",
                "partial/test/uniqueend1.fnt",
                "partial/test/uniqueend2.fnt",
                "no/match/here",
                "no/match/here",
                "partial/test/uniqueend3",
                "partial/test/uniqueend4.fnt",
                "no/match/here",
                "no/match/here",
            });

            properties.User.Returns(new StartupConfig
            {
                FontFolder = "partial"
            });

            IFontLoader loader = new FontLoader(
                appAssembly,
                fontsAssembly,
                messenger,
                gpuSurfaceManager,
                properties,
                subFontGenerator,
                filesystem);

            var result = loader.FindDotFntFileNamePartialMatchesFromFileResource("test");

            Assert.Equal(4, result.Count);
        }