parent
d0efe824ec
commit
f4a44ea80f
@ -1,52 +1,65 @@
|
|||||||
using Entities;
|
using Entities;
|
||||||
|
|
||||||
namespace TestEF;
|
namespace TestEF.EntitiesTests;
|
||||||
|
|
||||||
public class TestInquiryTableEntity
|
public class TestInquiryTableEntity
|
||||||
{
|
{
|
||||||
private const int _inquiryId = 42;
|
private const int InquiryId = 42;
|
||||||
private static InquiryEntity _inquiry = new InquiryEntity();
|
private static readonly InquiryEntity Inquiry = new InquiryEntity();
|
||||||
private const string _databaseName = "Database";
|
private const string DatabaseName = "Database";
|
||||||
private const string _connectionInfo = "Connection";
|
private const string ConnectionInfo = "Connection";
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestDefaultConstructor()
|
public void TestDefaultConstructor()
|
||||||
{
|
{
|
||||||
InquiryTableEntity tableEntity = new InquiryTableEntity();
|
InquiryTableEntity tableEntity = new InquiryTableEntity();
|
||||||
Assert.Equal(0,tableEntity.OwnerId);
|
Assert.Equal(0, tableEntity.OwnerId);
|
||||||
Assert.Null(tableEntity.Owner);
|
Assert.Null(tableEntity.Owner);
|
||||||
Assert.Null(tableEntity.DatabaseName);
|
Assert.Null(tableEntity.DatabaseName);
|
||||||
Assert.Null(tableEntity.ConnectionInfo);
|
Assert.Null(tableEntity.ConnectionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestConstructorWithOnlyId()
|
public void TestConstructorWithOnlyId()
|
||||||
{
|
{
|
||||||
InquiryTableEntity tableEntity = new InquiryTableEntity(_inquiryId);
|
InquiryTableEntity tableEntity = new InquiryTableEntity
|
||||||
Assert.Equal(_inquiryId,tableEntity.OwnerId);
|
{
|
||||||
|
OwnerId = InquiryId
|
||||||
|
};
|
||||||
|
Assert.Equal(InquiryId, tableEntity.OwnerId);
|
||||||
Assert.Null(tableEntity.Owner);
|
Assert.Null(tableEntity.Owner);
|
||||||
Assert.Null(tableEntity.DatabaseName);
|
Assert.Null(tableEntity.DatabaseName);
|
||||||
Assert.Null(tableEntity.ConnectionInfo);
|
Assert.Null(tableEntity.ConnectionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestConstructorWithoutId()
|
public void TestConstructorWithoutId()
|
||||||
{
|
{
|
||||||
InquiryTableEntity tableEntity = new InquiryTableEntity(_inquiry,_databaseName,_connectionInfo);
|
InquiryTableEntity tableEntity = new InquiryTableEntity
|
||||||
Assert.Equal(0,tableEntity.OwnerId);
|
{
|
||||||
Assert.Equal(_inquiry,tableEntity.Owner);
|
Owner = Inquiry,
|
||||||
Assert.Equal(_databaseName,tableEntity.DatabaseName);
|
DatabaseName = DatabaseName,
|
||||||
Assert.Equal(_connectionInfo,tableEntity.ConnectionInfo);
|
ConnectionInfo = ConnectionInfo
|
||||||
|
};
|
||||||
|
Assert.Equal(0, tableEntity.OwnerId);
|
||||||
|
Assert.Equal(Inquiry, tableEntity.Owner);
|
||||||
|
Assert.Equal(DatabaseName, tableEntity.DatabaseName);
|
||||||
|
Assert.Equal(ConnectionInfo, tableEntity.ConnectionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestConstructorWithoutNavigationProperty()
|
public void TestConstructorWithoutNavigationProperty()
|
||||||
{
|
{
|
||||||
InquiryTableEntity tableEntity = new InquiryTableEntity(_inquiryId,_databaseName,_connectionInfo);
|
InquiryTableEntity tableEntity = new InquiryTableEntity
|
||||||
Assert.Equal(_inquiryId,tableEntity.OwnerId);
|
{
|
||||||
|
OwnerId = InquiryId,
|
||||||
|
DatabaseName = DatabaseName,
|
||||||
|
ConnectionInfo = ConnectionInfo
|
||||||
|
};
|
||||||
|
Assert.Equal(InquiryId, tableEntity.OwnerId);
|
||||||
Assert.Null(tableEntity.Owner);
|
Assert.Null(tableEntity.Owner);
|
||||||
Assert.Equal(_databaseName,tableEntity.DatabaseName);
|
Assert.Equal(DatabaseName, tableEntity.DatabaseName);
|
||||||
Assert.Equal(_connectionInfo,tableEntity.ConnectionInfo);
|
Assert.Equal(ConnectionInfo, tableEntity.ConnectionInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in new issue