-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
1,380 additions
and
1,022 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
using System; | ||
using Wilcommerce.Auth.Models; | ||
using Xunit; | ||
|
||
namespace Wilcommerce.Auth.Test.Models | ||
{ | ||
public class UserTest | ||
{ | ||
#region Administrator tests | ||
[Theory] | ||
[InlineData(null)] | ||
[InlineData("")] | ||
public void AdministratorFactory_Should_Throw_ArgumentNull_Exception_If_Name_IsEmpty(string value) | ||
{ | ||
var ex = Assert.Throws<ArgumentException>(() => User.CreateAsAdministrator( | ||
value, | ||
"[email protected]", | ||
true)); | ||
|
||
Assert.Equal("name", ex.ParamName); | ||
} | ||
|
||
[Theory] | ||
[InlineData(null)] | ||
[InlineData("")] | ||
public void AdministratorFactory_Should_Throw_ArgumentNull_Exception_If_Email_IsEmpty(string value) | ||
{ | ||
var ex = Assert.Throws<ArgumentException>(() => User.CreateAsAdministrator( | ||
"Administrator", | ||
value, | ||
true)); | ||
|
||
Assert.Equal("email", ex.ParamName); | ||
} | ||
|
||
#endregion | ||
|
||
#region Customer tests | ||
[Theory] | ||
[InlineData(null)] | ||
[InlineData("")] | ||
public void CustomerFactory_Should_Throw_ArgumentNull_Exception_If_Name_IsEmpty(string value) | ||
{ | ||
var ex = Assert.Throws<ArgumentException>(() => User.CreateAsCustomer( | ||
value, | ||
"[email protected]")); | ||
|
||
Assert.Equal("name", ex.ParamName); | ||
} | ||
|
||
[Theory] | ||
[InlineData(null)] | ||
[InlineData("")] | ||
public void CustomerFactory_Should_Throw_ArgumentNull_Exception_If_Email_IsEmpty(string value) | ||
{ | ||
var ex = Assert.Throws<ArgumentException>(() => User.CreateAsCustomer( | ||
"Customer", | ||
value)); | ||
|
||
Assert.Equal("email", ex.ParamName); | ||
} | ||
#endregion | ||
|
||
[Fact] | ||
public void Enable_Should_Active_User_And_Set_Date_To_Null() | ||
{ | ||
var user = User.CreateAsAdministrator( | ||
"Admin", | ||
"[email protected]", | ||
false); | ||
|
||
user.Enable(); | ||
|
||
Assert.True(user.IsActive); | ||
Assert.Null(user.DisabledOn); | ||
} | ||
|
||
[Fact] | ||
public void Disable_Should_Set_Date_To_Now() | ||
{ | ||
var user = User.CreateAsAdministrator( | ||
"Admin", | ||
"[email protected]", | ||
true); | ||
|
||
user.Disable(); | ||
|
||
Assert.False(user.IsActive); | ||
Assert.Equal(DateTime.Today, ((DateTime)user.DisabledOn).Date); | ||
} | ||
|
||
[Theory] | ||
[InlineData("")] | ||
[InlineData(null)] | ||
public void ChangeName_Should_Throw_ArgumentNullException_If_Name_IsEmpty(string value) | ||
{ | ||
var user = User.CreateAsAdministrator( | ||
"Admin", | ||
"[email protected]", | ||
true); | ||
|
||
var ex = Assert.Throws<ArgumentException>(() => user.ChangeName(value)); | ||
Assert.Equal("name", ex.ParamName); | ||
} | ||
|
||
[Fact] | ||
public void SetProfileImage_Should_Throw_ArgumentNullException_If_Image_IsNull() | ||
{ | ||
var user = User.CreateAsAdministrator( | ||
"Admin", | ||
"[email protected]", | ||
true); | ||
|
||
var ex = Assert.Throws<ArgumentNullException>(() => user.SetProfileImage(null)); | ||
Assert.Equal("profileImage", ex.ParamName); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_Should_Initialize_Empty_ProfileImage() | ||
{ | ||
var admin = User.CreateAsAdministrator( | ||
"Administrator", | ||
"[email protected]", | ||
true); | ||
|
||
Assert.NotNull(admin.ProfileImage); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/Wilcommerce.Auth/Commands/Handlers/Interfaces/IRecoverPasswordCommandHandler.cs
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/Wilcommerce.Auth/Commands/Handlers/Interfaces/IValidatePasswordRecoveryCommandHandler.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.