NordicSemiconductor / IOS-CoreBluetooth-Mock

Mocking library for CoreBluetooth framework.
BSD 3-Clause "New" or "Revised" License
227 stars 52 forks source link

Tearing down improved and Unit Tests fixed #20

Closed philips77 closed 4 years ago

philips77 commented 4 years ago

This PR improves tearDownSimulation() method added in #18. It is not required to tear down the test before starting a new one. The manager may be powered off using CBMCentralManagerMock.simulatePowerOff(), which allows to set new test peripheral specifications. Tearing down will invalidate all current instances of CBMCentralManagerMock, so new instances will have to be created.

philips77 commented 4 years ago

This PR also fixes Unit Tests. However, they will only work on a simulator, as the mock/native implementation is chosen based on whether targetEnvironment is simulator. The setUp() method in XCTestCase is called after the central manager is instantiated, so setting the flag in there does not work in the sample app.