Implement Test Case
This commit is contained in:
parent
774e9e3782
commit
952179eee3
2 changed files with 31 additions and 0 deletions
|
@ -17,3 +17,4 @@ dev_dependencies:
|
||||||
build_test: ^0.10.3+1
|
build_test: ^0.10.3+1
|
||||||
build_web_compilers: ^0.4.0
|
build_web_compilers: ^0.4.0
|
||||||
test: ^1.3.0
|
test: ^1.3.0
|
||||||
|
mockito: ^3.0.0
|
||||||
|
|
30
test/service/configuration_service_test.dart
Normal file
30
test/service/configuration_service_test.dart
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue