1: /// <summary>
2: /// Initializes the demo route for test purposes.
3: /// <para />
4: /// Calling this method will register the test version of the <see cref="ILocationService"/>.
5: /// </summary>
6: private void InitializeDemoRoute()
7: {
8: // This is a demo app, register test version of the service
9: // In normal situations, you would not directly cast a service to a specific type in your view-model,
10: // only in unit tests to set the expected locations. However, since we simply want to show the power
11: // of IoC in combination with the location service, we register the service here and directly retrieve
12: // it to simulate a user walking through a street
13: IoC.IoCProvider.Instance.RegisterType<ILocationService, MVVM.Services.Test.LocationService>();
14: var testLocationService = (MVVM.Services.Test.LocationService)GetService<ILocationService>();
15:
16: TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, 500);
17:
18: // First one is longer because maps need to initialize
19: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38772d, 5.56484d), new TimeSpan(0, 0, 0, 5)));
20: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38771d, 5.56484d), timeSpan));
21: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38770d, 5.56484d), timeSpan));
22: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38769d, 5.56483d), timeSpan));
23: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38768d, 5.56483d), timeSpan));
24: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38767d, 5.56483d), timeSpan));
25:
26: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38766d, 5.56482d), timeSpan));
27: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38765d, 5.56482d), timeSpan));
28: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38764d, 5.56482d), timeSpan));
29: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38763d, 5.56481d), timeSpan));
30: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38762d, 5.56481d), timeSpan));
31: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38761d, 5.56481d), timeSpan));
32:
33: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38760d, 5.56480d), timeSpan));
34: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38759d, 5.56480d), timeSpan));
35: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38758d, 5.56480d), timeSpan));
36: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38757d, 5.56479d), timeSpan));
37: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38756d, 5.56479d), timeSpan));
38: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38755d, 5.56479d), timeSpan));
39:
40: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38754d, 5.56478d), timeSpan));
41: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38753d, 5.56478d), timeSpan));
42: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38752d, 5.56478d), timeSpan));
43: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38751d, 5.56477d), timeSpan));
44: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38750d, 5.56477d), timeSpan));
45: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38749d, 5.56477d), timeSpan));
46:
47: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38748d, 5.56476d), timeSpan));
48: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38747d, 5.56476d), timeSpan));
49: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38746d, 5.56476d), timeSpan));
50: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38745d, 5.56475d), timeSpan));
51: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38744d, 5.56475d), timeSpan));
52: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38743d, 5.56475d), timeSpan));
53:
54: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38742d, 5.56474d), timeSpan));
55: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38741d, 5.56474d), timeSpan));
56: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38740d, 5.56474d), timeSpan));
57: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38739d, 5.56473d), timeSpan));
58: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38738d, 5.56473d), timeSpan));
59: testLocationService.ExpectedLocations.Enqueue(new LocationTestData(new Location(51.38737d, 5.56473d), timeSpan));
60: }