cellular-automata/test/service/configuration_service_test.dart
2018-08-25 16:43:38 +02:00

30 lines
811 B
Dart

import 'package:rules_of_living/src/Engine.dart';
@TestOn('browser')
import 'package:test/test.dart';
import 'package:rules_of_living/service/configuration_service.dart';
import 'package:rules_of_living/service/engine_service.dart';
import 'package:mockito/mockito.dart';
class MockEngine extends Mock implements Engine {}
class MockEngineService extends Mock implements EngineService {
MockEngine _engine = MockEngine();
@override
Engine get engine => _engine;
}
void main() {
group("simulation speed", () {
ConfigurationService sut;
MockEngineService mes;
setUp(() {
mes = MockEngineService();
sut = ConfigurationService(mes);
});
test("speed changes propagate to engine", () {
sut.simSpeed = 312;
verify(mes.engine.stepsPerSecond=312);
});
});
}