Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions RockLib.Diagnostics.Tests/ConsoleTraceListenerTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using FluentAssertions;
using Moq;
using RockLib.Dynamic;
using System;
using System.IO;
using System.Reflection;
using Xunit;

namespace RockLib.Diagnostics.UnitTests
Expand All @@ -16,7 +16,9 @@ public void ConstructorSetsDefaultNameAndOutput()

traceListener.Name.Should().Be("");

TextWriter consoleWriter = traceListener.Unlock()._consoleWriter;
var consoleWriter = (TextWriter)typeof(ConsoleTraceListener)
.GetField("_consoleWriter", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(traceListener)!;

consoleWriter.Should().BeSameAs(Console.Out);

Expand All @@ -30,7 +32,9 @@ public void ConstructorSetsSpecifiedNameAndOutput()

traceListener.Name.Should().Be("TestName");

TextWriter consoleWriter = traceListener.Unlock()._consoleWriter;
var consoleWriter = (TextWriter)typeof(ConsoleTraceListener)
.GetField("_consoleWriter", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(traceListener)!;

consoleWriter.Should().BeSameAs(Console.Error);

Expand All @@ -54,7 +58,9 @@ public void WritePassesMessage()

var mockTextWriter = new Mock<TextWriter>();

traceListener.Unlock()._consoleWriter = mockTextWriter.Object;
var consoleWriter = typeof(ConsoleTraceListener)
.GetField("_consoleWriter", BindingFlags.Instance | BindingFlags.NonPublic)!;
consoleWriter.SetValue(traceListener, mockTextWriter.Object);

traceListener.Write("Test message");

Expand All @@ -70,7 +76,9 @@ public void WriteLinePassesMessage()

var mockTextWriter = new Mock<TextWriter>();

traceListener.Unlock()._consoleWriter = mockTextWriter.Object;
var consoleWriter = typeof(ConsoleTraceListener)
.GetField("_consoleWriter", BindingFlags.Instance | BindingFlags.NonPublic)!;
consoleWriter.SetValue(traceListener, mockTextWriter.Object);

traceListener.WriteLine("Test message");

Expand Down
5 changes: 2 additions & 3 deletions RockLib.Diagnostics.Tests/RockLib.Diagnostics.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="RockLib.UniversalMemberAccessor" Version="2.0.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
15 changes: 10 additions & 5 deletions RockLib.Diagnostics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 5.0.0 - 2025-02-12

### Changed
- Finalizing 5.0.0 release

## 5.0.0-alpha.1 - 2025-02-06

### Changed
RockLib.Configuration.4.0.3 -> RockLib.Configuration.5.0.0
RockLib.Configuration.ObjectFactory.3.0.0 -> RockLib.Configuration.4.0.0
- RockLib.Configuration.4.0.3 -> RockLib.Configuration.5.0.0
- RockLib.Configuration.ObjectFactory.3.0.0 -> RockLib.Configuration.4.0.0

## 4.0.0 - 2025-01-24

### Changed
* Removed .NET 6 as a target framework
- Removed .NET 6 as a target framework

## 3.0.2 - 2024-10-17

### Changed
RockLib.Configuration.4.0.1 -> RockLib.Configuration.4.0.3 to fix vulnerability
- RockLib.Configuration.4.0.1 -> RockLib.Configuration.4.0.3 to fix vulnerability

## 3.0.1 - 2024-07-15

### Changed
RockLib.Configuration.4.0.0 -> RockLib.Configuration.4.0.1 to fix vulnerability
- RockLib.Configuration.4.0.0 -> RockLib.Configuration.4.0.1 to fix vulnerability

## 3.0.0 - 2024-02-21

Expand Down
4 changes: 2 additions & 2 deletions RockLib.Diagnostics/RockLib.Diagnostics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>A changelog is available at https://github.com/RockLib/RockLib.Diagnostics/blob/main/RockLib.Diagnostics/CHANGELOG.md.</PackageReleaseNotes>
<PackageTags>RockLib Trace TraceSource Configuration</PackageTags>
<PackageVersion>5.0.0-alpha.1</PackageVersion>
<PackageVersion>5.0.0</PackageVersion>
<PublishRepositoryUrl>True</PublishRepositoryUrl>
<Version>5.0.0-alpha.1</Version>
<Version>5.0.0</Version>
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(PackageId).xml</DocumentationFile>
Expand Down