public void ManagePersonalLocationsViewModelInit() { MockPersonalLocationService service = InitializeMockPersonalLocationService(); using (ManagePersonalLocationsViewModel viewModel = new ManagePersonalLocationsViewModel(new PersonalLocationModel(service))) { Assert.AreEqual(2, viewModel.UserLocations.Count); Assert.AreEqual(0, viewModel.UserLocations[0].Id); Assert.AreEqual(1, viewModel.UserLocations[1].Id); Assert.AreEqual("Home", viewModel.UserLocations[0].Description); Assert.AreEqual(43.0M, viewModel.UserLocations[0].Latitude); Assert.AreEqual(-79.0M, viewModel.UserLocations[0].Longitude); } }
public void ManagePersonalLocationsViewModelAddLocation() { MockPersonalLocationService service = InitializeMockPersonalLocationService(); using (ManagePersonalLocationsViewModel viewModel = new ManagePersonalLocationsViewModel(new PersonalLocationModel(service))) { viewModel.Latitude = 41.0; viewModel.Longitude = -75.0; viewModel.Description = "Mom's house"; viewModel.AddLocationCommand.Execute(null); Assert.AreEqual(3, viewModel.UserLocations.Count); Assert.AreEqual(2, viewModel.UserLocations[2].Id); Assert.AreEqual("Mom's house", viewModel.UserLocations[2].Description); Assert.AreEqual(41.0M, viewModel.UserLocations[2].Latitude); Assert.AreEqual(-75.0M, viewModel.UserLocations[2].Longitude); } }
/// <summary> /// Provides a deterministic way to create the ManagePersonalLocations property. /// </summary> public static void CreateManagePersonalLocations() { if (managePersonalLocations == null) { managePersonalLocations = new ManagePersonalLocationsViewModel(); } }
/// <summary> /// Provides a deterministic way to delete the ManagePersonalLocations property. /// </summary> public static void ClearManagePersonalLocations() { if (managePersonalLocations != null) { managePersonalLocations.Cleanup(); } managePersonalLocations = null; }