예제 #1
0
        public void ShouldConvertDocumentToFileNameIfNoSolutionIsOpen()
        {
            var documentMock = new Mock <Document>();

            documentMock.Setup(doc => doc.Language).Returns("CSharp");
            documentMock.Setup(doc => doc.FullName)
            .Returns(@"C:\Users\Sven Amann\Documents\External\Reference\GoldenHammer.cs");
            documentMock.Setup(doc => doc.DTE).Returns(MockDTE.Create());

            var documentName = documentMock.Object.GetName();

            NameAssert.AreEqual(@"CSharp GoldenHammer.cs", documentName);
        }
예제 #2
0
        public void ShouldConvertDocumentToFileNameIfItIsSolutionExternal()
        {
            var documentMock = new Mock <Document>();

            documentMock.Setup(doc => doc.Language).Returns("Properties");
            documentMock.Setup(doc => doc.FullName).Returns(@"D:\My\Private\Stuff.Properties");
            documentMock.Setup(doc => doc.DTE)
            .Returns(
                DTEMockUtils.MockSolution(
                    @"C:\Users\Sven Amann\Documents\Projects\KaVE-Solution\Solution.sln").DTE);

            var documentName = documentMock.Object.GetName();

            NameAssert.AreEqual(@"Properties Stuff.Properties", documentName);
        }
예제 #3
0
        public void ShouldConvertSolutionDocumentToRelativeName()
        {
            var documentMock = new Mock <Document>();

            documentMock.Setup(doc => doc.Language).Returns("Project");
            documentMock.Setup(doc => doc.FullName)
            .Returns(@"C:\Users\Sven Amann\Documents\Projects\KaVE-Solution\Project\Project.csproj");
            documentMock.Setup(doc => doc.DTE)
            .Returns(
                DTEMockUtils.MockSolution(
                    @"C:\Users\Sven Amann\Documents\Projects\KaVE-Solution\Solution.sln").DTE);

            var documentName = documentMock.Object.GetName();

            NameAssert.AreEqual(@"Project \Project\Project.csproj", documentName);
        }