Пример #1
0
        public IEnumerable <App> Create()
        {
            foreach (var type in AppTypeProvider.GetTypes())
            {
                var attribute = CustomAttributeExtensions.GetCustomAttribute <AppAttribute>(type);

                var translationAttribute = CustomAttributeExtensions.GetCustomAttribute <TranslationsAttribute>(type);
                var translations         = translationAttribute != null?TranslationRepositoryCreator.Create(translationAttribute.Path) : new EmptyTranslationRepository();

                yield return(new App(
                                 attribute.Id,
                                 scripts: ScriptCreator.Create(type),
                                 styles: StyleCreator.Create(type),
                                 translations: translations
                                 ));
            }
        }
        public void ThrowsOnMissingFile()
        {
            var sut = new TranslationRepositoryCreator(Mock.Of <IEmbeddedResourceProvider>(), null);

            Assert.Throws <FileNotFoundException>(() => sut.Create("missing-file"));
        }