public void CreateFolderNode_CreatesNode() { var nfac = new NodeFactory(_io.Object); var node = nfac.CreateFolderNode("Foo"); Assert.IsNotNull(node); }
public void CreateFileNode_LooksUpProviders_AndCreatesNode() { var nfac = new NodeFactory(_io.Object); var provider = new Mock<IFileProvider>(); var newNode = new Mock<IFileNode>(); provider.Setup(x => x.Extensions).Returns(new[] {".txt"}); provider.Setup(x => x.Create(It.IsAny<string>(), It.IsAny<IProjectIO>())).Returns(newNode.Object); nfac.Register(provider.Object); Assert.AreSame(newNode.Object, nfac.CreateFileNode("foo.txt")); }
public IProject Build(string path, bool newProject) { var io = new ProjectIO(Path.GetDirectoryName(path)); var nfac = new NodeFactory(io); foreach (var p in _fileProviders) nfac.Register(p); var pprovider = FindProvider(path); if (newProject) { pprovider.CreateDefaultContents(Path.GetFileName(path), io, nfac); } return pprovider.Create(Path.GetFileName(path), io, nfac); }