Helios-Browser-Tests.st 885 B

1234567891011121314151617181920212223242526272829
  1. Smalltalk createPackage: 'Helios-Browser-Tests'!
  2. TestCase subclass: #HLBrowserTest
  3. instanceVariableNames: 'browser'
  4. package: 'Helios-Browser-Tests'!
  5. !HLBrowserTest commentStamp!
  6. Test cases for the functionality of `HLBrowserModel`!
  7. !HLBrowserTest methodsFor: 'tests'!
  8. setUp
  9. browser := HLBrowserModel new.
  10. !
  11. testAllProtocolsSelectedWhenSelectingAClass
  12. self assert: browser selectedProtocol isNil.
  13. browser selectedClass: Object.
  14. self assert: browser selectedProtocol equals: browser allProtocol.
  15. !
  16. testProtocolSelectedWhenChangingClass
  17. | protocolSelectedCalled |
  18. protocolSelectedCalled := 0.
  19. browser announcer on: HLProtocolSelected do: [protocolSelectedCalled := protocolSelectedCalled + 1] for: self.
  20. browser selectedClass: Object.
  21. self assert: protocolSelectedCalled equals: 1.
  22. browser selectedClass: ProtoObject.
  23. self assert: protocolSelectedCalled equals: 2.
  24. ! !