-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from Encamina/@lmarcos/text_splitter_improvements
Text splitter improvements
- Loading branch information
Showing
11 changed files
with
240 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Encamina.Enmarcha.Testing; | ||
|
||
/// <summary> | ||
/// Represents an implementation of the <see cref="IOptionsMonitor{TOptions}"/> interface for testing purposes. | ||
/// </summary> | ||
/// <typeparam name="TOptions">The type of options being monitored.</typeparam> | ||
public sealed class TestOptionsMonitor<TOptions> : IOptionsMonitor<TOptions> | ||
{ | ||
private Action<TOptions, string> currentListener; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TestOptionsMonitor{TOptions}"/> class. | ||
/// </summary> | ||
public TestOptionsMonitor() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TestOptionsMonitor{TOptions}"/> class with the specified initial value. | ||
/// </summary> | ||
/// <param name="currentValue">The initial value of the options.</param> | ||
public TestOptionsMonitor(TOptions currentValue) | ||
{ | ||
CurrentValue = currentValue; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public TOptions CurrentValue { get; private set; } | ||
|
||
/// <inheritdoc/> | ||
public TOptions Get(string name) => CurrentValue; | ||
|
||
/// <summary> | ||
/// Sets the current value of the options and invokes the change listener if registered. | ||
/// </summary> | ||
/// <param name="value">The new value of the options.</param> | ||
public void Set(TOptions value) | ||
{ | ||
CurrentValue = value; | ||
currentListener?.Invoke(value, string.Empty); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public IDisposable OnChange(Action<TOptions, string> listener) | ||
{ | ||
this.currentListener = listener; | ||
return null; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
tst/Encamina.Enmarcha.AI.Tests/Encamina.Enmarcha.AI.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Encamina.Enmarcha.AI\Encamina.Enmarcha.AI.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.