예제 #1
0
        public async Task GetsItemsToBeNuked()
        {
            var fakeFileSystem  = FakeFileSystem.Fake(Files);
            var fakeGitFileList = new FakeGitFileList();
            var fakeConsole     = Substitute.For <IConsole>();

            var nuker = await Nuker.CreateAsync(@"D:\Fake", fakeFileSystem, fakeGitFileList, fakeConsole);

            var actual = nuker.GetItemsToBeNuked();

            Assert.Contains(actual, i => i.Path == @"D:\Fake\src\Fake\bin" && i.Type == ItemType.Directory);
            Assert.Contains(actual, i => i.Path == @"D:\Fake\src\Fake\obj" && i.Type == ItemType.Directory);
            Assert.DoesNotContain(actual, i => i.Path == @"D:\Fake\src\Fake\node_modules\foo\bin");
        }
예제 #2
0
        public async Task NukesItems()
        {
            var fakeFileSystem  = FakeFileSystem.Fake(Files);
            var fakeGitFileList = new FakeGitFileList();
            var fakeConsole     = Substitute.For <IConsole>();

            var nuker = await Nuker.CreateAsync(@"D:\Fake", fakeFileSystem, fakeGitFileList, fakeConsole);

            var actual = nuker.GetItemsToBeNuked();

            nuker.NukeItems(actual);

            fakeFileSystem.Directory.Received().Delete(@"D:\Fake\src\Fake\bin", true);
            fakeFileSystem.Directory.Received().Delete(@"D:\Fake\src\Fake\obj", true);
            fakeFileSystem.Directory.DidNotReceive().Delete(@"D:\Fake\src\Fake\node_modules\foo\bin");
        }