public async Task ViewModel_MessageCenter_CharactersViewModel_MessageCenter_DeleteData_Should_Pass() { MockForms.Init(); // Get State of the DataStore, and set to run on the Mock var myDataStoreEnum = MasterDataStore.GetDataStoreMockFlag(); MasterDataStore.ToggleDataStore(DataStoreEnum.Mock); var myViewModel = new CharactersViewModel(); var myData = DefaultModels.CharacterDefault(); await myViewModel.AddAsync(myData); var myPage = new DeleteCharacterPage(new CharacterDetailViewModel(new Character())); MessagingCenter.Send(myPage, "DeleteData", myData); var Actual = await myViewModel.GetAsync(myData.Id); Object Expected = null; // Return state MasterDataStore.ToggleDataStore(myDataStoreEnum); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public async Task ViewModel_CharactersViewModel_UpdateData_Should_Pass() { MockForms.Init(); // Get State of the DataStore, and set to run on the Mock var myDataStoreEnum = MasterDataStore.GetDataStoreMockFlag(); MasterDataStore.ToggleDataStore(DataStoreEnum.Mock); var myViewModel = new CharactersViewModel(); var myData = DefaultModels.CharacterDefault(); await myViewModel.AddAsync(myData); var value = "new"; myData.Name = value; var myReturn = myViewModel.UpdateAsync(myData); var Actual = await myViewModel.GetAsync(myData.Id); string Expected = value; // Return state MasterDataStore.ToggleDataStore(myDataStoreEnum); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual.Name, TestContext.CurrentContext.Test.Name); }
//Load the characters from the battleViewModel, (only the living ones) private void GetCharacters() { List <Character> CharacterList = BattleViewModel.Instance.SelectedCharacters.ToList <Character>(); for (int i = 0; i < CharacterList.Count; i++) { if (CharacterList[i].Alive) { _viewModel.AddAsync(CharacterList[i]); } } }