public async Task ViewModel_ScoresViewModel_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 ScoresViewModel(); var myData = DefaultModels.ScoreDefault(); 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); }
public async Task ViewModel_MessageCenter_ScoresViewModel_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 ScoresViewModel(); var myData = DefaultModels.ScoreDefault(); await myViewModel.AddAsync(myData); var myPage = new ScoreDeletePage(new ScoreDetailViewModel(new Score())); 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_ScoresViewModel_UpdateData_Bogus_Should_Skip() { 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 ScoresViewModel(); myViewModel.ForceDataRefresh(); var myData = DefaultModels.ScoreDefault(); // Make the ID bogus... var value = "new"; myData.Id = value; var myReturn = await myViewModel.UpdateAsync(myData); var Actual = myReturn; bool Expected = false; // Return state MasterDataStore.ToggleDataStore(myDataStoreEnum); myViewModel.ForceDataRefresh(); // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public void ViewModel_ScoreViewModel_Instantiate_With_Data_Should_Pass() { MockForms.Init(); var myData = DefaultModels.ScoreDefault(); var value = "hi"; myData.Name = value; var Actual = new ScoreDetailViewModel(myData); Assert.AreEqual(value, Actual.Title, TestContext.CurrentContext.Test.Name); }
public void ViewModel_ScoreViewModel_GetData_With_Data_Should_Pass() { MockForms.Init(); var myData = DefaultModels.ScoreDefault(); var value = "hi"; myData.Name = value; var myViewModel = new ScoreDetailViewModel(myData); var Actual = myViewModel.Data; var Expected = myData; Assert.AreEqual(Expected.Name, Actual.Name, TestContext.CurrentContext.Test.Name); }