Fix tests
This commit is contained in:
parent
367b13e175
commit
33b2ea9a6a
@ -7,7 +7,6 @@ namespace Nocr.TextMatcher.AppServices.UnitTests;
|
|||||||
public class TextMatchTests
|
public class TextMatchTests
|
||||||
{
|
{
|
||||||
private const long UserId = 1;
|
private const long UserId = 1;
|
||||||
private const long ChatId = 1;
|
|
||||||
|
|
||||||
private static DateTimeOffset CreatedDateTime = new DateTimeOffset(2024, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
private static DateTimeOffset CreatedDateTime = new DateTimeOffset(2024, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
||||||
|
|
||||||
@ -15,11 +14,11 @@ public class TextMatchTests
|
|||||||
public void IsMatches_SameChatId_FullRule_MatchesText()
|
public void IsMatches_SameChatId_FullRule_MatchesText()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var match = TextMatch.Initialize(UserId, "Барахолка", "велосипед", TextMatchRule.Full, CreatedDateTime, ChatId);
|
var match = TextMatch.Initialize(UserId, "Барахолка", "велосипед", TextMatchRule.Full, CreatedDateTime);
|
||||||
var text = "Продам снежный велосипед 100 лари. Гудаури.";
|
var text = "Продам снежный велосипед 100 лари. Гудаури.";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = match.IsMatches(ChatId, "Барахолка", text);
|
var result = match.IsMatches("Барахолка", text);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.True(result);
|
Assert.True(result);
|
||||||
@ -30,11 +29,11 @@ public class TextMatchTests
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var match = TextMatch.Initialize(UserId, "Барахолка", "iphone айфон", TextMatchRule.AnyWord,
|
var match = TextMatch.Initialize(UserId, "Барахолка", "iphone айфон", TextMatchRule.AnyWord,
|
||||||
CreatedDateTime, ChatId);
|
CreatedDateTime);
|
||||||
var text = "Продам айфон велосипед 100 лари. Гудаури.";
|
var text = "Продам айфон велосипед 100 лари. Гудаури.";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = match.IsMatches(ChatId, "Барахолка", text);
|
var result = match.IsMatches("Барахолка", text);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.True(result);
|
Assert.True(result);
|
||||||
@ -45,11 +44,11 @@ public class TextMatchTests
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var match = TextMatch.Initialize(UserId, "Барахолка", "iphone айфон", TextMatchRule.AnyWord,
|
var match = TextMatch.Initialize(UserId, "Барахолка", "iphone айфон", TextMatchRule.AnyWord,
|
||||||
CreatedDateTime, ChatId);
|
CreatedDateTime);
|
||||||
var text = "Гомарджоба. Продам iphone (айфон) 1000 лари. Гудаури.";
|
var text = "Гомарджоба. Продам iphone (айфон) 1000 лари. Гудаури.";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = match.IsMatches(ChatId, "Барахолка", text);
|
var result = match.IsMatches("Барахолка", text);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.True(result);
|
Assert.True(result);
|
||||||
@ -59,10 +58,10 @@ public class TextMatchTests
|
|||||||
public void IsMatches_DifferentChatIdAndUserName_NotMatchesText()
|
public void IsMatches_DifferentChatIdAndUserName_NotMatchesText()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var match = TextMatch.Initialize(UserId, "Барахолка", "iphone", TextMatchRule.Full, CreatedDateTime, ChatId);
|
var match = TextMatch.Initialize(UserId, "Барахолка", "iphone", TextMatchRule.Full, CreatedDateTime);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = match.IsMatches(0, string.Empty, "iphone");
|
var result = match.IsMatches(string.Empty, "iphone");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.False(result);
|
Assert.False(result);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user