diff options
Diffstat (limited to 'slips/src/app/Marina/Domain/Slip.cs')
| -rw-r--r-- | slips/src/app/Marina/Domain/Slip.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/slips/src/app/Marina/Domain/Slip.cs b/slips/src/app/Marina/Domain/Slip.cs new file mode 100644 index 0000000..6b8a9b7 --- /dev/null +++ b/slips/src/app/Marina/Domain/Slip.cs @@ -0,0 +1,46 @@ +using Marina.Domain.Exceptions;
+using Marina.Domain.Interfaces;
+
+namespace Marina.Domain {
+ public class Slip : DomainObject, ISlip {
+ public Slip( long id, IDock dock, int width, int length, bool isLeased ) : base( id ) {
+ _dock = dock;
+ _width = width;
+ _length = length;
+ _isLeased = isLeased;
+ }
+
+ public IDock Dock() {
+ return _dock;
+ }
+
+ public ILocation Location() {
+ return _dock.Location( );
+ }
+
+ public int Width() {
+ return _width;
+ }
+
+ public int Length() {
+ return _length;
+ }
+
+ public ISlipLease LeaseTo( ICustomer customer, ILeaseDuration duration ) {
+ if ( !IsLeased( ) ) {
+ _isLeased = true;
+ return new SlipLease( this, duration );
+ }
+ throw new SlipIsAlreadyLeasedException( );
+ }
+
+ public bool IsLeased() {
+ return _isLeased;
+ }
+
+ private readonly IDock _dock;
+ private readonly int _width;
+ private readonly int _length;
+ private bool _isLeased;
+ }
+}
\ No newline at end of file |
