|
|
|
@ -1,19 +1,19 @@
|
|
|
|
|
using Entities;
|
|
|
|
|
|
|
|
|
|
namespace TestEF;
|
|
|
|
|
namespace TestEF.EntitiesTests;
|
|
|
|
|
|
|
|
|
|
public class TestInquiryTableEntity
|
|
|
|
|
{
|
|
|
|
|
private const int _inquiryId = 42;
|
|
|
|
|
private static InquiryEntity _inquiry = new InquiryEntity();
|
|
|
|
|
private const string _databaseName = "Database";
|
|
|
|
|
private const string _connectionInfo = "Connection";
|
|
|
|
|
private const int InquiryId = 42;
|
|
|
|
|
private static readonly InquiryEntity Inquiry = new InquiryEntity();
|
|
|
|
|
private const string DatabaseName = "Database";
|
|
|
|
|
private const string ConnectionInfo = "Connection";
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestDefaultConstructor()
|
|
|
|
|
{
|
|
|
|
|
InquiryTableEntity tableEntity = new InquiryTableEntity();
|
|
|
|
|
Assert.Equal(0,tableEntity.OwnerId);
|
|
|
|
|
Assert.Equal(0, tableEntity.OwnerId);
|
|
|
|
|
Assert.Null(tableEntity.Owner);
|
|
|
|
|
Assert.Null(tableEntity.DatabaseName);
|
|
|
|
|
Assert.Null(tableEntity.ConnectionInfo);
|
|
|
|
@ -22,8 +22,11 @@ public class TestInquiryTableEntity
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestConstructorWithOnlyId()
|
|
|
|
|
{
|
|
|
|
|
InquiryTableEntity tableEntity = new InquiryTableEntity(_inquiryId);
|
|
|
|
|
Assert.Equal(_inquiryId,tableEntity.OwnerId);
|
|
|
|
|
InquiryTableEntity tableEntity = new InquiryTableEntity
|
|
|
|
|
{
|
|
|
|
|
OwnerId = InquiryId
|
|
|
|
|
};
|
|
|
|
|
Assert.Equal(InquiryId, tableEntity.OwnerId);
|
|
|
|
|
Assert.Null(tableEntity.Owner);
|
|
|
|
|
Assert.Null(tableEntity.DatabaseName);
|
|
|
|
|
Assert.Null(tableEntity.ConnectionInfo);
|
|
|
|
@ -33,20 +36,30 @@ public class TestInquiryTableEntity
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestConstructorWithoutId()
|
|
|
|
|
{
|
|
|
|
|
InquiryTableEntity tableEntity = new InquiryTableEntity(_inquiry,_databaseName,_connectionInfo);
|
|
|
|
|
Assert.Equal(0,tableEntity.OwnerId);
|
|
|
|
|
Assert.Equal(_inquiry,tableEntity.Owner);
|
|
|
|
|
Assert.Equal(_databaseName,tableEntity.DatabaseName);
|
|
|
|
|
Assert.Equal(_connectionInfo,tableEntity.ConnectionInfo);
|
|
|
|
|
InquiryTableEntity tableEntity = new InquiryTableEntity
|
|
|
|
|
{
|
|
|
|
|
Owner = Inquiry,
|
|
|
|
|
DatabaseName = DatabaseName,
|
|
|
|
|
ConnectionInfo = ConnectionInfo
|
|
|
|
|
};
|
|
|
|
|
Assert.Equal(0, tableEntity.OwnerId);
|
|
|
|
|
Assert.Equal(Inquiry, tableEntity.Owner);
|
|
|
|
|
Assert.Equal(DatabaseName, tableEntity.DatabaseName);
|
|
|
|
|
Assert.Equal(ConnectionInfo, tableEntity.ConnectionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestConstructorWithoutNavigationProperty()
|
|
|
|
|
{
|
|
|
|
|
InquiryTableEntity tableEntity = new InquiryTableEntity(_inquiryId,_databaseName,_connectionInfo);
|
|
|
|
|
Assert.Equal(_inquiryId,tableEntity.OwnerId);
|
|
|
|
|
InquiryTableEntity tableEntity = new InquiryTableEntity
|
|
|
|
|
{
|
|
|
|
|
OwnerId = InquiryId,
|
|
|
|
|
DatabaseName = DatabaseName,
|
|
|
|
|
ConnectionInfo = ConnectionInfo
|
|
|
|
|
};
|
|
|
|
|
Assert.Equal(InquiryId, tableEntity.OwnerId);
|
|
|
|
|
Assert.Null(tableEntity.Owner);
|
|
|
|
|
Assert.Equal(_databaseName,tableEntity.DatabaseName);
|
|
|
|
|
Assert.Equal(_connectionInfo,tableEntity.ConnectionInfo);
|
|
|
|
|
Assert.Equal(DatabaseName, tableEntity.DatabaseName);
|
|
|
|
|
Assert.Equal(ConnectionInfo, tableEntity.ConnectionInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|