743 lines
20 KiB
C#
743 lines
20 KiB
C#
using ChatBot.Models.Configuration;
|
||
using FluentAssertions;
|
||
|
||
namespace ChatBot.Tests.Models;
|
||
|
||
public class TelegramBotSettingsTests
|
||
{
|
||
[Fact]
|
||
public void Constructor_ShouldInitializePropertiesWithDefaultValues()
|
||
{
|
||
// Arrange & Act
|
||
var settings = new TelegramBotSettings();
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(string.Empty);
|
||
}
|
||
|
||
[Fact]
|
||
public void BotToken_ShouldBeSettable()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var expectedToken = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk";
|
||
|
||
// Act
|
||
settings.BotToken = expectedToken;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(expectedToken);
|
||
}
|
||
|
||
[Theory]
|
||
[InlineData("")]
|
||
[InlineData("1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk")]
|
||
[InlineData("1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk-")]
|
||
[InlineData("1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk_")]
|
||
[InlineData("1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk.")]
|
||
[InlineData("1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk+")]
|
||
[InlineData("1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk/")]
|
||
[InlineData("1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk=")]
|
||
public void BotToken_ShouldAcceptVariousFormats(string token)
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
|
||
// Act
|
||
settings.BotToken = token;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(token);
|
||
}
|
||
|
||
[Fact]
|
||
public void AllProperties_ShouldBeMutable()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
|
||
// Act
|
||
settings.BotToken = "9876543210:ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba";
|
||
|
||
// Assert
|
||
settings
|
||
.BotToken.Should()
|
||
.Be("9876543210:ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba");
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportEmptyToken()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
|
||
// Act
|
||
settings.BotToken = "";
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be("");
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportNullToken()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
|
||
// Act
|
||
settings.BotToken = null!;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().BeNull();
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportValidBotToken()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var validToken = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk";
|
||
|
||
// Act
|
||
settings.BotToken = validToken;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(validToken);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportShortBotToken()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var shortToken = "123:ABC";
|
||
|
||
// Act
|
||
settings.BotToken = shortToken;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(shortToken);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportLongBotToken()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var longToken =
|
||
"12345678901234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
||
|
||
// Act
|
||
settings.BotToken = longToken;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(longToken);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithNumbers()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithNumbers = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk1234567890";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithNumbers;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithNumbers);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithLetters()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithLetters = "abcdefghij:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithLetters;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithLetters);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithMixedCase()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithMixedCase = "1234567890:AbCdEfGhIjKlMnOpQrStUvWxYz";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithMixedCase;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithMixedCase);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithSpecialCharacters()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithSpecialChars = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk-_.+/=";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithSpecialChars;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithSpecialChars);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithColon()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithColon = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk:";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithColon;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithColon);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithUnderscores()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithUnderscores = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk_";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithUnderscores;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithUnderscores);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithHyphens()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithHyphens = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk-";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithHyphens;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithHyphens);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithDots()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithDots = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk.";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithDots;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithDots);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithPlus()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithPlus = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk+";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithPlus;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithPlus);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithSlash()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithSlash = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk/";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithSlash;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithSlash);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithEquals()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithEquals = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk=";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithEquals;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithEquals);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithUnicode()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithUnicode = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkабвгд";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithUnicode;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithUnicode);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithSpaces()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithSpaces = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk ";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithSpaces;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithSpaces);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithTabs()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithTabs = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk\t";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithTabs;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithTabs);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithNewlines()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithNewlines = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk\n";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithNewlines;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithNewlines);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithCarriageReturn()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithCarriageReturn = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk\r";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithCarriageReturn;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithCarriageReturn);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithQuotes()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithQuotes = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk\"";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithQuotes;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithQuotes);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithSingleQuotes()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithSingleQuotes = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk'";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithSingleQuotes;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithSingleQuotes);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithBackslashes()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithBackslashes = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk\\";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithBackslashes;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithBackslashes);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithForwardSlashes()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithForwardSlashes = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk/";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithForwardSlashes;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithForwardSlashes);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithPipes()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithPipes = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk|";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithPipes;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithPipes);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithAmpersands()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithAmpersands = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk&";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithAmpersands;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithAmpersands);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithPercents()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithPercents = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk%";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithPercents;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithPercents);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithDollarSigns()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithDollarSigns = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk$";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithDollarSigns;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithDollarSigns);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithAtSigns()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithAtSigns = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk@";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithAtSigns;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithAtSigns);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithHashSigns()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithHashSigns = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk#";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithHashSigns;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithHashSigns);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithExclamationMarks()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithExclamationMarks = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk!";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithExclamationMarks;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithExclamationMarks);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithQuestionMarks()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithQuestionMarks = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk?";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithQuestionMarks;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithQuestionMarks);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithBrackets()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithBrackets = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk[]";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithBrackets;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithBrackets);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithBraces()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithBraces = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk{}";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithBraces;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithBraces);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithParentheses()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithParentheses = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk()";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithParentheses;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithParentheses);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithAngleBrackets()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithAngleBrackets = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk<>";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithAngleBrackets;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithAngleBrackets);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithTildes()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithTildes = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk~";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithTildes;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithTildes);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithCaret()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithCaret = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk^";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithCaret;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithCaret);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithBackticks()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithBackticks = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk`";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithBackticks;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithBackticks);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithSemicolons()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithSemicolons = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk;";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithSemicolons;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithSemicolons);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithCommas()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithCommas = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk,";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithCommas;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithCommas);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithPeriods()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithPeriods = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk.";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithPeriods;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithPeriods);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithAllSpecialCharacters()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithAllSpecialChars =
|
||
"1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk-_.+/=:;\"'\\|&%$@#!?[]{}()<>~^`";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithAllSpecialChars;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithAllSpecialChars);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportVeryLongBotToken()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var veryLongToken =
|
||
"12345678901234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||
|
||
// Act
|
||
settings.BotToken = veryLongToken;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(veryLongToken);
|
||
settings.BotToken.Length.Should().BeGreaterThan(100);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithOnlyNumbers()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithOnlyNumbers = "1234567890:123456789012345678901234567890";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithOnlyNumbers;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithOnlyNumbers);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithOnlyLetters()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithOnlyLetters = "abcdefghij:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithOnlyLetters;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithOnlyLetters);
|
||
}
|
||
|
||
[Fact]
|
||
public void Settings_ShouldSupportBotTokenWithMixedContent()
|
||
{
|
||
// Arrange
|
||
var settings = new TelegramBotSettings();
|
||
var tokenWithMixedContent =
|
||
"1234567890:AbC123dEf456GhI789jKl012MnO345pQr678sTu901vWx234yZ567";
|
||
|
||
// Act
|
||
settings.BotToken = tokenWithMixedContent;
|
||
|
||
// Assert
|
||
settings.BotToken.Should().Be(tokenWithMixedContent);
|
||
}
|
||
}
|