Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/Activity.vb
===================================================================
diff -u -r1733 -r1737
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/Activity.vb (.../Activity.vb) (revision 1733)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/Activity.vb (.../Activity.vb) (revision 1737)
@@ -32,12 +32,12 @@
End Sub
'''
- Public Sub StopActivity(employee As IEmployee) Implements IActivityActions.StopActivity
- State.StopActivity(employee)
+ Public Sub StopActivity() Implements IActivityActions.StopActivity
+ State.StopActivity()
End Sub
'''
- Public Sub FinishActivity(employee As IEmployee) Implements IActivityActions.FinishActivity
- State.FinishActivity(employee)
+ Public Sub FinishActivity() Implements IActivityActions.FinishActivity
+ State.FinishActivity()
End Sub
End Class
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityDefaultedState.vb
===================================================================
diff -u -r1734 -r1737
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityDefaultedState.vb (.../ActivityDefaultedState.vb) (revision 1734)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityDefaultedState.vb (.../ActivityDefaultedState.vb) (revision 1737)
@@ -13,6 +13,10 @@
'''
Public Overrides Sub StartActivity(employee As IEmployee)
+ If IsNothing(employee) Then
+ 'Nothing employee.
+ Throw New Exception($"The employee can't be nothing when starting an activity from defaulted state.")
+ End If
'Update employee.
employee.CurrentActivity = me.Activity
'Change state.
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityStartedState.vb
===================================================================
diff -u -r1735 -r1737
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityStartedState.vb (.../ActivityStartedState.vb) (revision 1735)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityStartedState.vb (.../ActivityStartedState.vb) (revision 1737)
@@ -24,22 +24,12 @@
End Function
'''
- Public Overrides Sub StopActivity(employee As IEmployee)
- If Not CurrentEmployee.Equals(employee) Then
- 'Different employee.
- Throw New Exception($"A different employee can't stop a started activity. Current activity belongs to {employee.ToString()}")
- End If
+ Public Overrides Sub StopActivity()
Activity.State = New ActivityStoppedState(Me)
End Sub
'''
- Public Overrides Sub FinishActivity(employee As IEmployee)
- If Not CurrentEmployee.Equals(employee) Then
- 'Different employee.
- Throw New Exception($"A different employee can't finish a started activity. Current activity belongs to {employee.ToString()}")
- End If
- 'Update employee.
- employee.CurrentActivity = Me.Activity
+ Public Overrides Sub FinishActivity()
'Update state.
Activity.State = New ActivityFinishedState(Me)
End Sub
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/IActivityActions.vb
===================================================================
diff -u -r1729 -r1737
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/IActivityActions.vb (.../IActivityActions.vb) (revision 1729)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/IActivityActions.vb (.../IActivityActions.vb) (revision 1737)
@@ -8,12 +8,10 @@
'''
''' The employee stops the activity.
'''
- '''
- Sub StopActivity(employee As IEmployee)
+ Sub StopActivity()
'''
''' The employee finishes the activity.
'''
- '''
- Sub FinishActivity(employee As IEmployee)
+ Sub FinishActivity()
End Interface
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityState.vb
===================================================================
diff -u -r1735 -r1737
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityState.vb (.../ActivityState.vb) (revision 1735)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityState.vb (.../ActivityState.vb) (revision 1737)
@@ -30,12 +30,12 @@
End Sub
'''
- Public Overridable Sub StopActivity(employee As IEmployee) Implements IActivityActions.StopActivity
+ Public Overridable Sub StopActivity() Implements IActivityActions.StopActivity
Throw New Exception("Can't stop the activity in this state.")
End Sub
'''
- Public Overridable Sub FinishActivity(employee As IEmployee) Implements IActivityActions.FinishActivity
+ Public Overridable Sub FinishActivity() Implements IActivityActions.FinishActivity
Throw New Exception("Can't finish the activity in this state.")
End Sub
End Class
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityStoppedState.vb
===================================================================
diff -u -r1735 -r1737
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityStoppedState.vb (.../ActivityStoppedState.vb) (revision 1735)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/activity state/ActivityStoppedState.vb (.../ActivityStoppedState.vb) (revision 1737)
@@ -25,6 +25,10 @@
'''
Public Overrides Sub StartActivity(employee As IEmployee)
+ If IsNothing(employee) Then
+ 'Nothing employee.
+ Throw New Exception($"The employee can't be nothing when starting an activity from stopped state.")
+ End If
'Update employee.
employee.CurrentActivity = me.Activity
'Everyone can start this activity.