You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
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);
|
|
}
|
|
}
|
|
} |