Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Project/Sources/Classes/UserProperties.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
property userId : Text
property userName : Text
property userEmail : Text
property userRole : Text

Class constructor($userId : Text; $userName : Text; $userEmail : Text; $userRole : Text)
This.userId := $userId
This.userName := $userName
This.userEmail := $userEmail
This.userRole := $userRole

Function getUserId() : Text
return This.userId

Function setUserId($userId : Text)
This.userId := $userId

Function getUserName() : Text
return This.userName

Function setUserName($userName : Text)
This.userName := $userName

Function getUserEmail() : Text
return This.userEmail

Function setUserEmail($userEmail : Text)
This.userEmail := $userEmail

Function getUserRole() : Text
return This.userRole

Function setUserRole($userRole : Text)
This.userRole := $userRole
45 changes: 45 additions & 0 deletions Project/Sources/Classes/UserProperties.test.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Class UserPropertiesTest

Check failure on line 1 in Project/Sources/Classes/UserProperties.test.4dm

View workflow job for this annotation

GitHub Actions / Build on macOS

Class code out of any function

Check failure on line 1 in Project/Sources/Classes/UserProperties.test.4dm

View workflow job for this annotation

GitHub Actions / Build on Windows

Class code out of any function

Check failure on line 1 in Project/Sources/Classes/UserProperties.test.4dm

View workflow job for this annotation

GitHub Actions / Build on macOS

Class code out of any function

Check failure on line 1 in Project/Sources/Classes/UserProperties.test.4dm

View workflow job for this annotation

GitHub Actions / Build on Windows

Class code out of any function

Check failure on line 1 in Project/Sources/Classes/UserProperties.test.4dm

View workflow job for this annotation

GitHub Actions / Build on ubuntu-24.04

Class code out of any function

Check failure on line 1 in Project/Sources/Classes/UserProperties.test.4dm

View workflow job for this annotation

GitHub Actions / Build on ubuntu-24.04

Class code out of any function

Function testInitialization()
var $userProperties : cs.UserProperties
$userProperties:=cs.UserProperties.new("1"; "John Doe"; "[email protected]"; "admin")

ASSERT($userProperties.getUserId()="1")
ASSERT($userProperties.getUserName()="John Doe")
ASSERT($userProperties.getUserEmail()="[email protected]")
ASSERT($userProperties.getUserRole()="admin")

Function testGettersAndSetters()
var $userProperties : cs.UserProperties
$userProperties:=cs.UserProperties.new("1"; "John Doe"; "[email protected]"; "admin")

$userProperties.setUserId("2")
ASSERT($userProperties.getUserId()="2")

$userProperties.setUserName("Jane Doe")
ASSERT($userProperties.getUserName()="Jane Doe")

$userProperties.setUserEmail("[email protected]")
ASSERT($userProperties.getUserEmail()="[email protected]")

$userProperties.setUserRole("user")
ASSERT($userProperties.getUserRole()="user")

Function testDifferentInputs()
var $userProperties : cs.UserProperties
$userProperties:=cs.UserProperties.new(""; ""; ""; "")

ASSERT($userProperties.getUserId()="")
ASSERT($userProperties.getUserName()="")
ASSERT($userProperties.getUserEmail()="")
ASSERT($userProperties.getUserRole()="")

$userProperties.setUserId("3")
$userProperties.setUserName("Alice")
$userProperties.setUserEmail("[email protected]")
$userProperties.setUserRole("guest")

ASSERT($userProperties.getUserId()="3")
ASSERT($userProperties.getUserName()="Alice")
ASSERT($userProperties.getUserEmail()="[email protected]")
ASSERT($userProperties.getUserRole()="guest")
Loading