Add Telegram bot integration and enhance user management features
- Introduced Telegram.Bot package for bot functionality. - Updated user management to include Telegram linking and blocking features. - Enhanced activation request handling with notifications via Telegram. - Added new database entities for Telegram link tokens and login requests. - Implemented traffic synchronization for client stats in the XuiPanelGateway. - Updated application structure to support new test projects and improved dependency injection for Telegram services.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using PnvPanel.Domain.Common;
|
||||
using Xunit;
|
||||
|
||||
namespace PnvPanel.Domain.Tests.Common;
|
||||
|
||||
public class EntityTests
|
||||
{
|
||||
private sealed class FakeEntityA : Entity
|
||||
{
|
||||
public FakeEntityA(Guid id) => Id = id;
|
||||
}
|
||||
|
||||
private sealed class FakeEntityB : Entity
|
||||
{
|
||||
public FakeEntityB(Guid id) => Id = id;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_SameTypeAndId_ReturnsTrue()
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
var a = new FakeEntityA(id);
|
||||
var b = new FakeEntityA(id);
|
||||
|
||||
Assert.Equal(a, b);
|
||||
Assert.True(a == b);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_DifferentTypesSameId_ReturnsFalse()
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
var a = new FakeEntityA(id);
|
||||
var b = new FakeEntityB(id);
|
||||
|
||||
Assert.False(a.Equals(b));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_SameTypeDifferentId_ReturnsFalse()
|
||||
{
|
||||
var a = new FakeEntityA(Guid.NewGuid());
|
||||
var b = new FakeEntityA(Guid.NewGuid());
|
||||
|
||||
Assert.NotEqual(a, b);
|
||||
Assert.True(a != b);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetHashCode_SameTypeAndId_AreEqual()
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
var a = new FakeEntityA(id);
|
||||
var b = new FakeEntityA(id);
|
||||
|
||||
Assert.Equal(a.GetHashCode(), b.GetHashCode());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user