Ejemplo n.º 1
0
        public void Locate_RelativePathIsNull_ArgumentNullException()
        {
            var vsUiShell = new Mock <IVsUIShellOpenDocument>();

            var testSubject = new AbsoluteFilePathLocator(CreateServiceProvider(vsUiShell.Object));

            Action act = () => testSubject.Locate(null);

            act.Should().ThrowExactly <ArgumentNullException>().And.ParamName.Should().Be("relativeFilePath");
            vsUiShell.Invocations.Count.Should().Be(0);
        }
Ejemplo n.º 2
0
        public void Locate_NoMatches_Null()
        {
            const string relativePath = "some relative path";

            var vsUiShell = SetupVsUiShellOpenDocument(relativePath, VSConstants.S_OK, null);

            var testSubject = new AbsoluteFilePathLocator(CreateServiceProvider(vsUiShell.Object));

            var result = testSubject.Locate(relativePath);

            result.Should().BeNull();

            vsUiShell.VerifyAll();
            vsUiShell.VerifyNoOtherCalls();
        }
Ejemplo n.º 3
0
        public void Locate_HasMatch_MatchReturned()
        {
            const string path         = "some relative path";
            const string absolutePath = "some absolute path";

            var vsUiShell = SetupVsUiShellOpenDocument(path, VSConstants.S_OK, absolutePath);

            var testSubject = new AbsoluteFilePathLocator(CreateServiceProvider(vsUiShell.Object));

            var result = testSubject.Locate(path);

            result.Should().Be(absolutePath);

            vsUiShell.VerifyAll();
            vsUiShell.VerifyNoOtherCalls();
        }