コード例 #1
0
        public TypeCheckerTest()
        {
            var currentDirectory = Directory.GetParent(Directory.GetCurrentDirectory());
            var config           = new Dictionary <string, object>
            {
                {
                    ConfigurationManager.MetadataDirKey,
                    Path.Combine(currentDirectory.Parent?.Parent?.ToString(), "Resources")
                }
            };

            var configurationProvider = new MockConfigurationProvider(config);

            var environment = new MockEnvironment();

            var fileMetadataAccessor = new FileMetadataAccessor();

            fileMetadataAccessor.SetMetadataPath((string)config[ConfigurationManager.MetadataDirKey]);

            var cache = new MockCache();

            var configurationManager = new ConfigurationManager(configurationProvider, environment, cache);

            _metadataProvider = configurationManager.NewMetadataProvider();
        }
コード例 #2
0
        public FileMetadataAccessorTest()
        {
            var currentDirectory = Directory.GetParent(Directory.GetCurrentDirectory());

            _metadataPath = Path.Combine(currentDirectory.Parent?.Parent?.ToString(), "Resources",
                                         "accessor_metadatas");

            _accessor = new FileMetadataAccessor();
            _accessor.SetMetadataPath(_metadataPath);
        }
コード例 #3
0
        public static ConfigurationManager BuildAs(bool isProd)
        {
            var currentDirectory = Directory.GetParent(Directory.GetCurrentDirectory());
            var config           = new Dictionary <string, object>
            {
                {
                    ConfigurationManager.MetadataDirKey,
                    Path.Combine(currentDirectory.Parent?.Parent?.ToString(), "Resources", "provider_metadatas")
                }
            };

            var configurationProvider = new MockConfigurationProvider(config);

            var environment = new MockEnvironment(isProd);

            var fileMetadataAccessor = new FileMetadataAccessor();

            fileMetadataAccessor.SetMetadataPath((string)config[ConfigurationManager.MetadataDirKey]);

            var cache = new MockProdCache(fileMetadataAccessor);

            return(new ConfigurationManager(configurationProvider, environment, cache));
        }
コード例 #4
0
ファイル: MockCache.cs プロジェクト: webbeta/NSerializer
 public MockProdCache(FileMetadataAccessor fileMetadataAccessor)
 {
     _fileMetadataAccessor = fileMetadataAccessor;
 }