コード例 #1
0
        public void CanSetValue_AlwaysReturnsFalse(string key)
        {
            // Arrange & Act
            var entry = new ErrorListTableEntry(_testMessage, LogLevel.Debug);

            // Assert
            entry.Should().NotBeNull();
            entry.CanSetValue(key).Should().BeFalse();
        }
コード例 #2
0
        public void StringConstructor_CreatesLogMessage()
        {
            // Arrange & Act
            var entry = new ErrorListTableEntry(_testMessage, LogLevel.Debug);

            // Assert
            entry.Should().NotBeNull();
            entry.Message.Should().NotBeNull();
            entry.Message.Message.Should().Be(_testMessage);
            entry.Message.Code.Should().Be(NuGetLogCode.Undefined);
            entry.Message.Level.Should().Be(LogLevel.Debug);
        }
コード例 #3
0
        public void LogMessageConstructor_KeepsLogMessage()
        {
            // Arrange
            var logMessage = new LogMessage(LogLevel.Debug, _testMessage, _testCode);

            // Act
            var entry = new ErrorListTableEntry(logMessage);

            // Assert
            entry.Should().NotBeNull();
            entry.Message.Should().Be(logMessage);
        }
コード例 #4
0
        public void TryGetValue_IntContentNotAvailable_ReturnsZero(string key)
        {
            // Arrange
            var logMessage = new LogMessage(LogLevel.Error, _testMessage, _testCode);

            // Act
            var entry = new ErrorListTableEntry(logMessage);

            // Assert
            entry.Should().NotBeNull();
            entry.TryGetValue(key, out var result).Should().BeFalse();
            result.Should().BeNull();
        }
コード例 #5
0
        public void TryGetValue_StringContent_ReturnsValues(string key, string content)
        {
            // Arrange
            var logMessage = new RestoreLogMessage(LogLevel.Error, _testCode, _testMessage)
            {
                ProjectPath = _testProjectPath
            };

            // Act
            var entry = new ErrorListTableEntry(logMessage);

            // Assert
            entry.Should().NotBeNull();
            entry.TryGetValue(key, out var result).Should().BeTrue();
            (result is string).Should().BeTrue();
            (result as string).Should().Be(content);
        }
コード例 #6
0
        public void TryGetValue_IntContent_ReturnsValues(string key, int content)
        {
            // Arrange
            var logMessage = new RestoreLogMessage(LogLevel.Error, _testCode, _testMessage)
            {
                StartLineNumber   = _testLineNumber,
                StartColumnNumber = _testColumnNumber
            };

            // Act
            var entry = new ErrorListTableEntry(logMessage);

            // Assert
            entry.Should().NotBeNull();
            entry.TryGetValue(key, out var result).Should().BeTrue();
            (result is int).Should().BeTrue();
            ((int)result).Should().Be(content);
        }