 import XCTest
 
 protocol CalendarPort {
+    
+    var isAuthorizedForEventsAccess: Bool { get }
 
     func requestAccessToEvents()
 
 }
 
 class CapturingCalendarPort: CalendarPort {
+    
+    var isAuthorizedForEventsAccess: Bool {
+        get {
+            return false
+        }
+    }
 
     private(set) var wasAskedForEventsPermissions = false
     func requestAccessToEvents() {
         wasAskedForEventsPermissions = true
     }
 
+}
+
+class AuthorizedCalendarPort: CapturingCalendarPort {
+    
+    override var isAuthorizedForEventsAccess: Bool {
+        get {
+            return true
+        }
+    }
+    
 }
 
 class CalendarService {

    }

    func add(event: Any) {
        calendar.requestAccessToEvents()
    }

}

        XCTAssertFalse(capturingCalendar.wasAskedForEventsPermissions)
    }
    
    func testEventsPermissionsShouldNotBeRequestedWhenAddingEventWhenTheCalendarIndicatesWeAreAlreadyAuthorized() {
        let capturingCalendar = AuthorizedCalendarPort()
        let service = CalendarService(calendar: capturingCalendar)
        let event = Event()
        service.add(event: event)
        
        XCTAssertFalse(capturingCalendar.wasAskedForEventsPermissions)
    }
    
}
