Пример #1
0
        public void GivenOnePathToOneDirectory_WhenInThisDirectoryIsNotAnySolution_ThenOneDirectoryNotFoundException_ShouldBeThrown()
        {
            var mockFileSystem = new MockFileSystem();
            var cut            = new EntryPointLocator(mockFileSystem);

            Action action = () => cut.GetEntryPoint(@"c:\foo\bar\");

            action.Should().Throw <DirectoryNotFoundException>();
        }
Пример #2
0
        public void GivenOnePathToOneProjectFile_WhenInThisFileDoesNotExist_ThenOneDirectoryNotFoundException_ShouldBeThrown()
        {
            var mockFileSystem = new MockFileSystem();

            mockFileSystem.AddDirectory(@"c:\foo\bar");
            var cut = new EntryPointLocator(mockFileSystem);

            Action action = () => cut.GetEntryPoint(@"c:\foo\bar\aa.fooproj");

            action.Should().Throw <FileNotFoundException>();
        }
Пример #3
0
        public void GivenOnePathToOneDirectory_WhenThisDirectoryContainsTwoSolutionFiles_ThenOneException_ShouldBeThrown()
        {
            var mockFileSystem = new MockFileSystem();

            mockFileSystem.AddFile(@"c:\foo\bar\xyz.sln", new MockFileData(""));
            mockFileSystem.AddFile(@"c:\foo\bar\g.sln", new MockFileData(""));
            var cut = new EntryPointLocator(mockFileSystem);

            Action action = () => cut.GetEntryPoint(@"c:\foo\bar\");

            action.Should().Throw <InvalidOperationException>();
        }
Пример #4
0
        public string Render(Module module)
        {
            var entryPointLocator = new EntryPointLocator();

            entryPointLocator.Visit(module);

            var visitor = new RenderingVisitor(entryPointLocator.EntryPointDeclarations, new CSharpWriter());

            visitor.Visit(module);

            var code = visitor.Writer.GenerateCode();

            return(code);
        }
Пример #5
0
        public void GivenOnePathToOneSolution_WhenInThisSolutionDoesExist_ThenThisSolution_ShouldBeResolved()
        {
            var mockFileSystem = new MockFileSystem();

            mockFileSystem.AddFile(@"c:\foo\bar\xyz.sln", new MockFileData(""));
            var cut = new EntryPointLocator(mockFileSystem);

            var actualResult = cut.GetEntryPoint(@"c:\foo\bar\xyz.sln");

            using (var _ = new AssertionScope())
            {
                actualResult.Type.Should().Be(EntryPointType.Solution);
                actualResult.File.FullName.Should().Be(@"c:\foo\bar\xyz.sln");
            }
        }