parent
31e167d19c
commit
534589dbdf
@ -0,0 +1,41 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto;
|
||||
|
||||
public class TestInquiryDTO
|
||||
{
|
||||
private const int _id = 1;
|
||||
private const string _title = "Title";
|
||||
private const string _description = "_description";
|
||||
private const bool _isUser = true;
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithId()
|
||||
{
|
||||
InquiryDTO inquiry = new InquiryDTO(_id, _title, _description, _isUser);
|
||||
Assert.Equal(_id, inquiry.Id);
|
||||
Assert.Equal(_title, inquiry.Title);
|
||||
Assert.Equal(_description, inquiry.Description);
|
||||
Assert.True(inquiry.IsUser);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithoutId()
|
||||
{
|
||||
InquiryDTO inquiry = new InquiryDTO(_title,_description,_isUser);
|
||||
Assert.Equal(0, inquiry.Id);
|
||||
Assert.Equal(_title,inquiry.Title);
|
||||
Assert.Equal(_description,inquiry.Description);
|
||||
Assert.True(inquiry.IsUser);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithAllAttributes()
|
||||
{
|
||||
InquiryDTO inquiry = new InquiryDTO(_id,_title,_description,_isUser);
|
||||
Assert.Equal(_id, inquiry.Id);
|
||||
Assert.Equal(_title,inquiry.Title);
|
||||
Assert.Equal(_description,inquiry.Description);
|
||||
Assert.True(inquiry.IsUser);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto;
|
||||
|
||||
public class TestInquiryTableDTO
|
||||
{
|
||||
private const int _id = 1;
|
||||
private const string _database = "database";
|
||||
private const string _connection = "_connection";
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithId()
|
||||
{
|
||||
InquiryTableDTO inquiry = new InquiryTableDTO(_id, _database, _connection);
|
||||
Assert.Equal(_id, inquiry.OwnerId);
|
||||
Assert.Equal(_database, inquiry.DatabaseName);
|
||||
Assert.Equal(_connection, inquiry.ConnectionInfo);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestDefaultConstructor()
|
||||
{
|
||||
InquiryTableDTO inquiry = new InquiryTableDTO();
|
||||
Assert.Equal(0, inquiry.OwnerId);
|
||||
Assert.Null(inquiry.DatabaseName);
|
||||
Assert.Null(inquiry.ConnectionInfo);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto;
|
||||
|
||||
public class TestLessonDTO
|
||||
{
|
||||
private const int _id = 42;
|
||||
private const string _title = "Title";
|
||||
private const string _lastPublisher = "Last Publisher";
|
||||
private static DateOnly _lastEdit = new DateOnly();
|
||||
|
||||
[Fact]
|
||||
public void TestDefaultConstructor()
|
||||
{
|
||||
LessonDTO lesson = new LessonDTO();
|
||||
Assert.Equal(0, lesson.Id);
|
||||
Assert.Null(lesson.Title);
|
||||
Assert.Null(lesson.LastPublisher);
|
||||
Assert.Null(lesson.LastEdit);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithoutId()
|
||||
{
|
||||
LessonDTO lesson = new LessonDTO(_title,_lastPublisher,_lastEdit);
|
||||
Assert.Equal(0, lesson.Id);
|
||||
Assert.Equal(_title,lesson.Title);
|
||||
Assert.Equal(_lastPublisher,lesson.LastPublisher);
|
||||
Assert.Equal(_lastEdit,lesson.LastEdit);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithAllAttributes()
|
||||
{
|
||||
LessonDTO lesson = new LessonDTO(_id,_title,_lastPublisher,_lastEdit);
|
||||
Assert.Equal(_id, lesson.Id);
|
||||
Assert.Equal(_title,lesson.Title);
|
||||
Assert.Equal(_lastPublisher,lesson.LastPublisher);
|
||||
Assert.Equal(_lastEdit,lesson.LastEdit);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto;
|
||||
|
||||
public class TestNotepadDTO
|
||||
{
|
||||
private const int _id = 42;
|
||||
private const int _userId = 42;
|
||||
private const int _inquiryId = 42;
|
||||
private const string _notes = "This is some notes example";
|
||||
|
||||
[Fact]
|
||||
public void TestDefaultConstructor()
|
||||
{
|
||||
NotepadDTO notepad = new NotepadDTO();
|
||||
Assert.Equal(0,notepad.Id);
|
||||
Assert.Equal(0,notepad.UserId);
|
||||
Assert.Equal(0,notepad.InquiryId);
|
||||
Assert.Null(notepad.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithoutId()
|
||||
{
|
||||
NotepadDTO notepad = new NotepadDTO(_userId,_inquiryId,_notes);
|
||||
Assert.Equal(0,notepad.Id);
|
||||
Assert.Equal(_userId,notepad.UserId);
|
||||
Assert.Equal(_inquiryId,notepad.InquiryId);
|
||||
Assert.Equal(_notes,notepad.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithAllAttributes()
|
||||
{
|
||||
NotepadDTO notepad = new NotepadDTO(_id,_userId,_inquiryId,_notes);
|
||||
Assert.Equal(_id,notepad.Id);
|
||||
Assert.Equal(_userId,notepad.UserId);
|
||||
Assert.Equal(_inquiryId,notepad.InquiryId);
|
||||
Assert.Equal(_notes,notepad.Notes);
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto;
|
||||
|
||||
public class TestParagraphDTO
|
||||
{
|
||||
private const int _id = 42;
|
||||
private const string _title = "Title";
|
||||
private const string _info = "Info";
|
||||
private const string _content = "Content";
|
||||
private const string _query = "Query";
|
||||
private const string _comment = "Comment";
|
||||
|
||||
[Fact]
|
||||
public void TestDefaultConstructor()
|
||||
{
|
||||
ParagraphDTO paragraph = new ParagraphDTO();
|
||||
Assert.Equal(0, paragraph.Id);
|
||||
Assert.Null(paragraph.Title);
|
||||
Assert.Null(paragraph.Info);
|
||||
Assert.Null(paragraph.Content);
|
||||
Assert.Null(paragraph.Query);
|
||||
Assert.Null(paragraph.Comment);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithoutId()
|
||||
{
|
||||
ParagraphDTO paragraph = new ParagraphDTO(_title,_content,_info,_query,_comment, 10);
|
||||
Assert.Equal(0, paragraph.Id);
|
||||
Assert.Equal(_title,paragraph.Title);
|
||||
Assert.Equal(_info,paragraph.Info);
|
||||
Assert.Equal(_content,paragraph.Content);
|
||||
Assert.Equal(_query,paragraph.Query);
|
||||
Assert.Equal(_comment,paragraph.Comment);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithAllAttributes()
|
||||
{
|
||||
ParagraphDTO paragraph = new ParagraphDTO(_id,_title,_content,_info,_query,_comment,10);
|
||||
Assert.Equal(_id, paragraph.Id);
|
||||
Assert.Equal(_title,paragraph.Title);
|
||||
Assert.Equal(_info,paragraph.Info);
|
||||
Assert.Equal(_content,paragraph.Content);
|
||||
Assert.Equal(_query,paragraph.Query);
|
||||
Assert.Equal(_comment,paragraph.Comment);
|
||||
Assert.Equal(10, paragraph.LessonId);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto;
|
||||
|
||||
public class TestSolutionDTO
|
||||
{
|
||||
private const string _murdererFirstName = "John";
|
||||
private const string _murdererLastName = "Doe";
|
||||
private const string _murderPlace = "WhiteHouse";
|
||||
private const string _murderWeapon = "Nuclear Bomb";
|
||||
private const string _explaination = "This is an explaination";
|
||||
private const int _inquiryId = 42;
|
||||
|
||||
[Fact]
|
||||
public void TestDefaultConstructor()
|
||||
{
|
||||
SolutionDTO solution = new SolutionDTO();
|
||||
Assert.Equal(0,solution.OwnerId);
|
||||
Assert.Null(solution.MurdererFirstName);
|
||||
Assert.Null(solution.MurdererLastName);
|
||||
Assert.Null(solution.MurderPlace);
|
||||
Assert.Null(solution.MurderWeapon);
|
||||
Assert.Null(solution.Explanation);
|
||||
}
|
||||
[Fact]
|
||||
public void TestConstructorWithoutOwnerId()
|
||||
{
|
||||
SolutionDTO solution = new SolutionDTO(_murdererFirstName,_murdererLastName,_murderPlace,_murderWeapon, _explaination);
|
||||
Assert.Equal(0,solution.OwnerId);
|
||||
Assert.Equal(_murdererFirstName,solution.MurdererFirstName);
|
||||
Assert.Equal(_murdererLastName,solution.MurdererLastName);
|
||||
Assert.Equal(_murderPlace,solution.MurderPlace);
|
||||
Assert.Equal(_murderWeapon,solution.MurderWeapon);
|
||||
Assert.Equal(_explaination, solution.Explanation);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithAllAttributes()
|
||||
{
|
||||
SolutionDTO solution = new SolutionDTO(_inquiryId,_murdererFirstName,_murdererLastName,_murderPlace,_murderWeapon, _explaination);
|
||||
Assert.Equal(_inquiryId,solution.OwnerId);
|
||||
Assert.Equal(_murdererFirstName,solution.MurdererFirstName);
|
||||
Assert.Equal(_murdererLastName,solution.MurdererLastName);
|
||||
Assert.Equal(_murderPlace,solution.MurderPlace);
|
||||
Assert.Equal(_murderWeapon,solution.MurderWeapon);
|
||||
Assert.Equal(_explaination, solution.Explanation);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto;
|
||||
|
||||
public class TestSuccessDTO
|
||||
{
|
||||
private const int _userId = 42;
|
||||
private const int _inquiryId = 7;
|
||||
private const bool _isFinished = true;
|
||||
|
||||
[Fact]
|
||||
public void TestDefaultConstructor()
|
||||
{
|
||||
SuccessDTO success = new SuccessDTO();
|
||||
Assert.Equal(0, success.UserId);
|
||||
Assert.Equal(0, success.InquiryId);
|
||||
Assert.False(success.IsFinished);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithIds()
|
||||
{
|
||||
SuccessDTO success = new SuccessDTO(_userId, _inquiryId, _isFinished);
|
||||
Assert.Equal(_userId, success.UserId);
|
||||
Assert.Equal(_inquiryId, success.InquiryId);
|
||||
Assert.True(success.IsFinished);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
using Dto;
|
||||
|
||||
namespace TestEF.Dto
|
||||
{
|
||||
public class TestUserDTO
|
||||
{
|
||||
private const string _username = "username";
|
||||
private const string _email = "example@email.com";
|
||||
private const string _password = "password";
|
||||
private const bool _isAdmin = true;
|
||||
private const int _id = 42;
|
||||
|
||||
[Fact]
|
||||
public void TestDefaultConstructor()
|
||||
{
|
||||
UserDTO user = new UserDTO();
|
||||
Assert.Equal(0,user.Id);
|
||||
Assert.Null(user.Username);
|
||||
Assert.Null(user.Email);
|
||||
Assert.Null(user.Password);
|
||||
Assert.False(user.IsAdmin);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithoutId()
|
||||
{
|
||||
UserDTO user = new UserDTO(_username, _password, _email, _isAdmin);
|
||||
Assert.Equal(0,user.Id);
|
||||
Assert.Equal(_username, user.Username);
|
||||
Assert.Equal(_email, user.Email);
|
||||
Assert.Equal(_password, user.Password);
|
||||
Assert.True(user.IsAdmin);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestConstructorWithoutAllAttributes()
|
||||
{
|
||||
UserDTO user = new UserDTO(_id, _username, _password, _email, _isAdmin);
|
||||
Assert.Equal(_id,user.Id);
|
||||
Assert.Equal(_username, user.Username);
|
||||
Assert.Equal(_email, user.Email);
|
||||
Assert.Equal(_password, user.Password);
|
||||
Assert.True(user.IsAdmin);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue