The Alarm class has a parametric constructor that accept any working implementation of ISensor so the OCP is satisfied by that parametric constructor (together with all the references in the class that are ISensor and not Sensor).
The violation you mentioned is of the DIP. An example that surface the violation is when the Sensor class is changed to remove the implementation of the ISensor. This requires also a change to the the Alarm default constructor.
Replacing the
new Sensor() with a factory remove the DIP violation, still the change mentioned before requires the same kind changes in the code to be done to the factory now.
In the Alarm class implementation [2] there is also one violation of the OCP that can have a minor impact like the violation you pointed out.
It is interesting to note here that in order to make the initial code [1] testable, the refactoring made to the code [2] removed major violations and this improved the design. At the same time some other minor violation remained there so there are still other opportunity for improving the design. This show how the practice of TDD with mocks guide devs to remove many common and serious violations but not all the possible violations, still the visible effect on the code-base and on the maintainability and evolvibility of the code support developers in better learning and understanding design in practice.
[1] TDDMicroExercises/CSharp/TirePressureMonitoringSystem/Alarm.cs
[2] TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem/Alarm.cs