Files
Deal/src/telegram-service/Deal.Telegram.Tests/Telegram/DialogHueTests.cs
T
Rustam Khalimov 39c9bdc1b7 Дочистить код-стайл: var встроенных типов, приватные доки, доки интерфейсам
Гейт csharp_style_var_for_built_in_types=false:warning (ломает сборку), остаток
выправлен dotnet format IDE0008 по 5 sln (только встроенные типы). Понижено 12
новых XML-доков private/internal, добавлены <summary> членам IContainerRules и
ITenantContext, 3 англоязычных комментария переведены на русский.
2026-09-11 19:00:35 +03:00

54 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Deal.Telegram.Dialogs;
namespace Deal.Telegram.Tests.Telegram;
/// <summary>
/// Unit-тесты цвета диалога.
/// </summary>
public sealed class DialogHueTests
{
/// <summary>
/// Цвет по паре
/// </summary>
[Theory]
[InlineData("-1001234567890", "IT Канал", "#a78bfa")]
[InlineData("-123456", "Уютный чат", "#34d399")]
[InlineData("+79990001122", "Иван Петров", "#fb7185")]
[InlineData("-100999", "", "#34d399")]
public void Compute_MatchesPythonPrototype(
string dialogId,
string name,
string expectedHue)
{
Assert.Equal(expectedHue, DialogHue.Compute(dialogId, name));
}
/// <summary>
/// Цвет детерминирован
/// </summary>
[Fact]
public void Compute_IsDeterministic()
{
string first = DialogHue.Compute("-1001234567890", "IT Канал");
Assert.Equal(first, DialogHue.Compute("-1001234567890", "IT Канал"));
}
/// <summary>
/// Разные источники распределяются по палитре
/// </summary>
[Fact]
public void Compute_DifferentSources_DistributeAcrossPalette()
{
string[] hues = new[]
{
DialogHue.Compute("-100111", "Канал А"),
DialogHue.Compute("-100222", "Канал Б"),
DialogHue.Compute("+79990001122", "Иван Петров"),
DialogHue.Compute("-5", "Работа"),
};
Assert.Equal(3, hues.Distinct().Count());
}
}