示例#1
0
        public void VerifyDoesNotShowForNoSymbol()
        {
            // Arrange
            var analyzer = new MemberImplementsInterfaceAnalyzer();

            // Act
            var shouldShow = analyzer.Show(symbol: null);

            // Assert
            Assert.IsFalse(shouldShow, $"The analyzer will be unexpectedly shown for no symbol");
        }
示例#2
0
        public void VerifyDoesNotShowForStaticMembers(SymbolKind symbolKind)
        {
            // Arrange
            var memberMock = SetupMemberMock(symbolKind, TypeKind.Unknown, isStatic: true);
            var analyzer   = new MemberImplementsInterfaceAnalyzer();

            // Act
            var shouldShow = analyzer.Show(memberMock.Object);

            // Assert
            Assert.IsFalse(shouldShow, $"The analyzer will be unexpectedly shown for static symbol '{symbolKind}'");
        }
示例#3
0
        public void VerifyDoesNotShowForNonMembers(SymbolKind symbolKind)
        {
            // Arrange
            var symbolMock = new Mock <ISymbol>();

            symbolMock.Setup(s => s.SymbolKind).Returns(symbolKind);
            var analyzer = new MemberImplementsInterfaceAnalyzer();

            // Act
            var shouldShow = analyzer.Show(symbolMock.Object);

            // Assert
            Assert.IsFalse(shouldShow, $"The analyzer will be unexpectedly shown for symbol '{symbolKind}'");
        }
示例#4
0
        public void VerifyShowsForSupportedTypes(
            [ValueSource(nameof(ValidSymbolKinds))] SymbolKind symbolKind,
            [ValueSource(nameof(ValidTypeKinds))] TypeKind typeKind)
        {
            // Arrange
            var memberMock = SetupMemberMock(symbolKind, typeKind, isStatic: false);
            var analyzer   = new MemberImplementsInterfaceAnalyzer();

            // Act
            var shouldShow = analyzer.Show(memberMock.Object);

            // Assert
            Assert.IsTrue(shouldShow, $"The analyzer will not be shown for symbol '{symbolKind}' and '{typeKind}'");
        }
示例#5
0
        public void VerifyDoesNotShowForUnsupportedTypes(
            [ValueSource(nameof(ValidSymbolKinds))] SymbolKind symbolKind,
            [ValueSource(nameof(InvalidTypeKinds))] TypeKind typeKind)
        {
            // Arrange
            var memberMock = SetupMemberMock(symbolKind, typeKind, isStatic: true);
            var analyzer   = new MemberImplementsInterfaceAnalyzer();

            // Act
            var shouldShow = analyzer.Show(memberMock.Object);

            // Assert
            Assert.IsFalse(shouldShow, $"The analyzer will be unexpectedly shown for symbol '{symbolKind}' and '{typeKind}'");
        }