ClearFiles() public method

public ClearFiles ( ) : void
return void
Beispiel #1
0
        public void SolutionRuleSetsInformationProvider_TryGetProjectRuleSetFilePath()
        {
            // Setup
            var testSubject = new SolutionRuleSetsInformationProvider(this.serviceProvider);
            var fileSystem  = new ConfigurableFileSystem();

            this.serviceProvider.RegisterService(typeof(IFileSystem), fileSystem);
            ProjectMock        project = new ProjectMock(@"c:\Solution\Project\Project1.myProj");
            RuleSetDeclaration declaration;
            string             ruleSetPath;

            // Case 1: Declaration has an full path which exists on disk
            declaration = CreateDeclaration(project, @"c:\RuleSet.ruleset");
            fileSystem.RegisterFile(declaration.RuleSetPath);

            // Act
            Assert.IsTrue(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath));

            // Verify
            Assert.AreEqual(@"c:\RuleSet.ruleset", ruleSetPath);

            // Case 2: Declaration is relative to project and on disk
            fileSystem.ClearFiles();
            declaration = CreateDeclaration(project, @"..\RuleSet.ruleset");
            fileSystem.RegisterFile(@"c:\Solution\RuleSet.ruleset");

            // Act
            Assert.IsTrue(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath));

            // Verify
            Assert.AreEqual(@"c:\Solution\RuleSet.ruleset", ruleSetPath);

            // Case 3: File doesn't exist
            fileSystem.ClearFiles();
            declaration = CreateDeclaration(project, "MyFile.ruleset");

            // Act
            Assert.IsFalse(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath));

            // Verify
            Assert.IsNull(ruleSetPath);
        }
        public void SolutionRuleSetsInformationProvider_TryGetProjectRuleSetFilePath()
        {
            // Setup
            var testSubject = new SolutionRuleSetsInformationProvider(this.serviceProvider);
            var fileSystem = new ConfigurableFileSystem();
            this.serviceProvider.RegisterService(typeof(IFileSystem), fileSystem);
            ProjectMock project = new ProjectMock(@"c:\Solution\Project\Project1.myProj");
            RuleSetDeclaration declaration;
            string ruleSetPath;

            // Case 1: Declaration has an full path which exists on disk
            declaration = CreateDeclaration(project, @"c:\RuleSet.ruleset");
            fileSystem.RegisterFile(declaration.RuleSetPath);

            // Act
            Assert.IsTrue(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath));

            // Verify
            Assert.AreEqual(@"c:\RuleSet.ruleset", ruleSetPath);

            // Case 2: Declaration is relative to project and on disk
            fileSystem.ClearFiles();
            declaration = CreateDeclaration(project, @"..\RuleSet.ruleset");
            fileSystem.RegisterFile(@"c:\Solution\RuleSet.ruleset");

            // Act
            Assert.IsTrue(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath));

            // Verify
            Assert.AreEqual(@"c:\Solution\RuleSet.ruleset", ruleSetPath);

            // Case 3: File doesn't exist
            fileSystem.ClearFiles();
            declaration = CreateDeclaration(project, "MyFile.ruleset");

            // Act
            Assert.IsFalse(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath));

            // Verify
            Assert.IsNull(ruleSetPath);
        }