Пример #1
0
        public void AddVirtualFolder_Should_SaveToDoc()
        {
            _io.Setup(x => x.CachedReadText(EmptyProjectName))
               .Returns(EmptyProjectText)
               .Verifiable();

            _io.Setup(m => m.AddVirtualFolder(@"C:\Sample"))
               .Verifiable();

            Scanning_RootFolder_Returns_Nothing();

            var folderMock = new Mock<IFolderNode>();
            folderMock.SetupGet(x => x.Path).Returns("Sample");
            _nfac.Setup(x => x.CreateFolderNode("Sample"))
                 .Returns(folderMock.Object)
                 .Verifiable();

            _io.Setup(x => x.WriteFile(EmptyProjectName, @"
            <Sample-Project>
            <Virtual-Folder>C:\Sample</Virtual-Folder>
            </Sample-Project>
            "));

            var project = new Project(EmptyProjectName, _io.Object, _nfac.Object);
            project.AddVirtualFolder(@"C:\Sample");

            _io.Verify();
            _nfac.Verify();
        }
Пример #2
0
        public void Init_Loads_Virtual_Folders()
        {
            _io.Setup(x => x.CachedReadText(OneNodeProjectName))
               .Returns(OneNodeProjectText)
               .Verifiable();

            Scanning_RootFolder_Returns_Nothing();

            var folderMock = new Mock<IFolderNode>();
            folderMock.SetupGet(x => x.Path).Returns("Sample");
            _nfac.Setup(x => x.CreateFolderNode(@"Sample"))
                 .Returns(folderMock.Object)
                 .Verifiable();

            var project = new Project(OneNodeProjectName, _io.Object, _nfac.Object);
            _io.Verify();
            _io.Verify(x => x.AddVirtualFolder(@"C:\Sample"), Times.Once());
            _nfac.Verify();

            Assert.AreEqual(1, project.Children.Count);
            Assert.AreSame(folderMock.Object, project.Children.First());
        }