コード例 #1
0
        public void TryGetProjectPath_NoTextDocument_ReturnsFalse()
        {
            // Arrange
            var textBuffer          = Mock.Of <ITextBuffer>();
            var projectPathProvider = new GuestProjectPathProvider(
                JoinableTaskContext,
                Mock.Of <ITextDocumentFactoryService>(),
                Mock.Of <ProxyAccessor>(),
                SessionAccessor);

            // Act
            var result = projectPathProvider.TryGetProjectPath(textBuffer, out var filePath);

            // Assert
            Assert.False(result);
            Assert.Null(filePath);
        }
コード例 #2
0
        public void TryGetProjectPath_NoTextDocument_ReturnsFalse()
        {
            // Arrange
            var textBuffer = Mock.Of <ITextBuffer>(MockBehavior.Strict);
            var textDocumentFactoryService = new Mock <ITextDocumentFactoryService>(MockBehavior.Strict);

            textDocumentFactoryService.Setup(s => s.TryGetTextDocument(It.IsAny <ITextBuffer>(), out It.Ref <ITextDocument> .IsAny)).Returns(false);
            var projectPathProvider = new GuestProjectPathProvider(
                JoinableTaskContext,
                textDocumentFactoryService.Object,
                Mock.Of <ProxyAccessor>(MockBehavior.Strict),
                SessionAccessor);

            // Act
            var result = projectPathProvider.TryGetProjectPath(textBuffer, out var filePath);

            // Assert
            Assert.False(result);
            Assert.Null(filePath);
        }