コード例 #1
0
        public void TryGetWorkspace_NoHostProject_ReturnsFalse()
        {
            // Arrange
            var workspaceAccessor = new DefaultVisualStudioMacWorkspaceAccessor(Mock.Of <TextBufferProjectService>());
            var textBuffer        = Mock.Of <ITextBuffer>();

            // Act
            var result = workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace);

            // Assert
            Assert.False(result);
        }
        public void TryGetWorkspace_NoHostProject_ReturnsFalse()
        {
            // Arrange
            var textBufferProjectService = new Mock <TextBufferProjectService>(MockBehavior.Strict);

            textBufferProjectService.Setup(s => s.GetHostProject(It.IsAny <ITextBuffer>())).Returns(value: null);
            var workspaceAccessor = new DefaultVisualStudioMacWorkspaceAccessor(textBufferProjectService.Object);
            var textBuffer        = Mock.Of <ITextBuffer>(MockBehavior.Strict);

            // Act
            var result = workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace);

            // Assert
            Assert.False(result);
        }