Пример #1
0
        public async Task Initialize()
        {
            const string prefix = "Docdown.Test.Files.";
            var          asm    = Assembly.GetExecutingAssembly();
            var          names  = asm.GetManifestResourceNames().Where(e => e.StartsWith(prefix));

            var dict = new Dictionary <string, MockFileData>();

            foreach (var name in names)
            {
                var fileName  = name.Substring(prefix.Length, name.Length - prefix.Length).Replace('.', '\\');
                var lastIndex = fileName.LastIndexOf('\\');
                fileName = fileName.Remove(lastIndex, 1).Insert(lastIndex, ".").Replace('_', '.');
                byte[] bytes;
                using (var stream = asm.GetManifestResourceStream(name))
                {
                    using (var ms = new MemoryStream())
                    {
                        stream.CopyTo(ms);
                        bytes = ms.ToArray();
                    }
                }
                dict.Add(fileName, new MockFileData(bytes));
            }

            FileSystem = new MockFileSystem(dict, @"C:\")
            {
                FileSystemWatcher = Watcher = new FileSystemWatcherFactory()
            };

            ConverterService = new MockConverterService();
            Workspace        = await WorkspaceProvider.Create(WorkspacePath, FileSystem, ConverterService);

            Workspace.WorkspaceChanged += delegate { };
            FileHandler = Workspace.Handlers.OfType <FileWorkspaceItemHandler>().First();
        }
Пример #2
0
 public void Create()
 {
     provider.Create();
     provider.CodeBase.ReflectionEquals(CodeBase.Empty(), true);
 }