private void RegisterAdapters() { var directoryAdapter = new DirectoryAdapter( Kernel.Resolve <IMapPath>(), !_AllowAccessOutsideRootFolder, RootFolder); Kernel.Register(Component.For <IDirectoryAdapter>().Instance(directoryAdapter).Named("directory.adapter")); //Kernel.AddComponentInstance("directory.adapter", typeof (IDirectoryAdapter), directoryAdapter); var fileAdapter = new FileAdapter( !_AllowAccessOutsideRootFolder, RootFolder); Kernel.Register(Component.For <IFileAdapter>().Instance(fileAdapter).Named("file.adapter")); //Kernel.AddComponentInstance("file.adapter", typeof (IFileAdapter), fileAdapter); if (Kernel.HasComponent(typeof(ITransactionManager))) { fileAdapter.TxManager = directoryAdapter.TxManager = Kernel.Resolve <ITransactionManager>(); } else { Kernel.ComponentRegistered += Kernel_ComponentRegistered; } }
public void CanGetLocalFile() { // "C:\Users\xyz\Documents\dev\logibit_cms\scm\trunk\Tests\Henrik.Cms.Tests\TestGlobals.cs"; var d = new DirectoryAdapter(new MapPathImpl(), false, null); string path = Path.GetPathWithoutLastBit(d.MapPath("~/../../TestGlobals.cs")); // get directory instead Console.WriteLine(path); Assert.That(d.Exists(path)); }
public FileSystem( IFileInfoFactory fileInfoFactory, IDirectoryInfoFactory directoryInfoFactory) { FileInfo = fileInfoFactory; DirectoryInfo = directoryInfoFactory; File = new FileAdapter(); Directory = new DirectoryAdapter(); Path = new PathAdapter(); }
private void RegisterAdapters() { var directoryAdapter = new DirectoryAdapter( Kernel.Resolve<IMapPath>(), !_AllowAccessOutsideRootFolder, RootFolder); Kernel.Register(Component.For<IDirectoryAdapter>().Named("directory.adapter").Instance(directoryAdapter)); var fileAdapter = new FileAdapter( !_AllowAccessOutsideRootFolder, RootFolder); Kernel.Register(Component.For<IFileAdapter>().Named("file.adapter").Instance(fileAdapter)); if (Kernel.HasComponent(typeof(ITransactionManager))) fileAdapter.TxManager = directoryAdapter.TxManager = Kernel.Resolve<ITransactionManager>(); else Kernel.ComponentRegistered += Kernel_ComponentRegistered; }
public void CtorWorksIfNullAndNotConstaint() { var adapter = new DirectoryAdapter(new MapPathImpl(), false, null); Assert.That(adapter.UseTransactions); }
public void SetUp() { _directoryAdapter = new DirectoryAdapter(); _fileAdapter = new FileAdapter(); }
public void DefaultSettings() { var adapter = new DirectoryAdapter(new MapPathImpl(), false, null); Assert.That(adapter.UseTransactions); Assert.That(adapter.OnlyJoinExisting, Is.False); }