public void ShouldFindProblemWhenEmpty() { // Arrange _codeBase.Projects.Add(new Project(@"C:\SomeFakePath\SomeFakeProject.csproj", new List <SourceFile>())); // Act var problems = _analyzer.FindProblems(_codeBase); // Assert problems.Should().HaveCount(1); }
public void ShouldFindProblemWhenSolutionContainsNoProject() { // Arrange _codeBase.Solutions.Add(new Solution(@"C:\MySolution.sln")); // Act var problems = _analyzer.FindProblems(_codeBase); // Assert problems.Should().HaveCount(1); }
public void ShouldNotFindProblemWhenAllFilesReferenced() { // Arrange _codeBase.Projects.Add(new Project(@"C:\SomeProject.csproj", new List <SourceFile>() { new SourceFile(@"C:\SomeSourceFile.cs") })); _codeBase.SourceFiles.Add(new SourceFile(@"C:\SomeSourceFile.cs")); // Act var problems = _analyzer.FindProblems(_codeBase); // Assert problems.Should().BeEmpty(); }
public void ShouldFindProblemForOneReferencedFileNotFound() { // Arrange _codeBase.Projects.Add(new Project(@"C:\SomeProject.csproj", new List <SourceFile>() { new SourceFile(@"C:\SomeFile.cs"), new SourceFile(@"C:\SomeFile2.cs") })); _codeBase.SourceFiles.Add(new SourceFile(@"C:\SomeFile.cs")); // Act var problems = _analyzer.FindProblems(_codeBase); // Assert problems.Should().HaveCount(1); }
public void ShouldNotFindProblemsWhenSameRepository() { // Arrange _codeBase.Projects.Add(new Project(@"C:\SomeProject.cs", new SourceFile[] { new SourceFile("SomeFile.cs") { Repository = _repository } }) { Repository = _repository }); // Act var problems = _analyzer.FindProblems(_codeBase); // Assert problems.Should().BeEmpty(); }
public void ShouldFindProblemWhenFileReferenceMultipleTimes() { // Arrange _codeBase.Projects.Add(new Project(@"C\SomePath\SomeProject.csproj", new List <SourceFile>() { new SourceFile(@"C:\SomeSourceFile.cs") })); _codeBase.Projects.Add(new Project(@"C\SomePath\SomeProject2.csproj", new List <SourceFile>() { new SourceFile(@"C:\SomeSourceFile.cs") })); // Act var problems = _analyzer.FindProblems(_codeBase); // Assert problems.Should().HaveCount(1); }
public void ShouldFindProblemWithNotReferencedProject() { // Arrange _codeBase.Projects.Add(new Project(@"C:\SomeProject.cs", new List <SourceFile>())); _codeBase.Projects.Add(new Project(@"C:\SomeProject2.cs", new List <SourceFile>())); _codeBase.Solutions.Add(new Solution(@"C:\SomeSolution.sln") { Projects = new List <Project>() { new Project(@"C:\SomeProject.cs", new List <SourceFile>()) } }); // Act var problems = _analyzer.FindProblems(_codeBase); problems.Should().HaveCount(1); }