Example #1
0
// Equal compares two Transaction objects. Implements the Objecter interface
func (transaction *Transaction) Equal(obj Objecter) bool {
	otherTransaction, ok := obj.(*Transaction)
	if !ok {
		return false
	}

	switch {
	case transaction.ID != otherTransaction.ID:
		return false
	case transaction.PayerID != otherTransaction.PayerID:
		return false
	case transaction.ReceiverID != otherTransaction.ReceiverID:
		return false
	case transaction.Type != otherTransaction.Type:
		return false
	case transaction.Ammount != otherTransaction.Ammount:
		return false
	case transaction.Currency != otherTransaction.Currency:
		return false
	case !util.CompareDates(transaction.Date, otherTransaction.Date):
		return false
	}

	return true
}
Example #2
0
func verifyUserCorresponds(t *testing.T, user *ApplicationUser) {
	dbuser, err := GetUser(user.ID)

	if err != nil || dbuser == nil {
		t.Error("Could not fetch the user document from the database!")
	}

	if user.AccountStatus != dbuser.AccountStatus || user.AccountType != dbuser.AccountType ||
		user.ActivateAccountToken != dbuser.ActivateAccountToken ||
		!util.CompareDates(user.ActivateAccountTokenExpireDate, dbuser.ActivateAccountTokenExpireDate) ||
		user.Email != dbuser.Email || user.Password != dbuser.Password ||
		user.ResetPasswordToken != dbuser.ResetPasswordToken ||
		!util.CompareDates(user.ResetPasswordTokenExpireDate, dbuser.ResetPasswordTokenExpireDate) {

		t.Error("The user document doesn't correspond with the document extracted from the database!")
	}
}